home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft_Programmers_Library.7z / MPL / common / codevw.txt next >
Encoding:
Text File  |  2013-11-08  |  883.2 KB  |  22,664 lines

  1.  Microsoft Codeview and Utilities User's Guide
  2.  
  3.  
  4.  ────────────────────────────────────────────────────────────────────────────
  5.  
  6.  
  7.  Microsoft(R) CodeView(R) and Utilities User's Guide
  8.  
  9.  Version 2.3
  10.  
  11.  for MS(R) OS/2 and MS-DOS(R) Operating Systems
  12.  
  13.  
  14.  ────────────────────────────────────────────────────────────────────────────
  15.  
  16.  
  17.  MICROSOFT CORPORATION
  18.  
  19.  Information in this document is subject to change without notice and does
  20.  not represent a commitment on the part of Microsoft Corporation. The
  21.  software described in this document is furnished under a license agreement
  22.  or nondisclosure agreement. The software may be used or copied only in
  23.  accordance with the terms of the agreement. It is against the law to copy
  24.  the software on any medium except as specifically allowed in the license or
  25.  nondisclosure agreement. No part of this manual may be reproduced or
  26.  transmitted in any form or by any means, electronic or mechanical, including
  27.  photocopying and recording, for any purpose without the express written
  28.  permission of Microsoft.
  29.  
  30.  (c)Copyright Microsoft Corporation, 1987, 1989. All rights reserved.
  31.  Simultaneously published in the U.S. and Canada.
  32.  
  33.  Printed and bound in the United States of America.
  34.  
  35.  Microsoft, MS, MS-DOS, XENIX, and  CodeView are registered trademarks of
  36.  Microsoft Corporation.
  37.  
  38.  AT&T is a registered trademark of American Telephone and Telegraph Company.
  39.  
  40.  Eagle is a registered trademark of Eagle Computer, Inc.
  41.  
  42.  IBM is a registered trademark of International Business Machines
  43.  Corporation.
  44.  
  45.  Intel is a registered trademark of Intel Corporation.
  46.  
  47.  Lotus is a registered trademark of Lotus Development Corporation.
  48.  
  49.  Tandy is a registered trademark of Tandy Corporation.
  50.  
  51.  Document No. LN0801A-500-R00-0889
  52.  Part No. 07824 10 9 8 7 6 5 4 3 2 1
  53.  
  54.  
  55.  Table of Contents
  56.  ───────────────────────────────────────────────────────────────────────────
  57.  
  58.  Introduction
  59.  New Features of the CodeView(R) Debugger
  60.  About this Manual
  61.  Document Conventions
  62.  
  63.  Part 1  The CodeView Debugger
  64.  
  65.  Chapter 1  Getting Started
  66.  1.1  Restrictions
  67.  1.2  The CodeView Environment
  68.  1.3  Preparing Programs for the CodeView Debugger
  69.        1.3.1  Programming Considerations
  70.        1.3.2  CodeView Compile Options
  71.        1.3.3  CodeView Link Options
  72.        1.3.4  Preparing C Programs
  73.        1.3.5  Preparing FORTRAN Programs
  74.        1.3.6  Preparing BASIC Programs
  75.        1.3.7  Preparing Pascal Programs
  76.        1.3.8  Preparing Assembly Programs
  77.  1.4  Starting the CodeView Debugger
  78.  1.5  Using CodeView Options
  79.        1.5.1  Using Two Video Adapters
  80.        1.5.2  Using the Enhanced Graphics Adapter's 43-Line Mode
  81.        1.5.3  Using 50-Line Mode
  82.        1.5.4  Starting with a Black-and-White Display
  83.        1.5.5  Specifying Start-Up Commands
  84.        1.5.6  Handling Interrupt Trapping (DOS Only)
  85.        1.5.7  Using Expanded Memory (DOS Only)
  86.        1.5.8  Setting the Screen-Exchange Mode (DOS Only)
  87.        1.5.9  Loading Information from Dynamic-Link Libraries (OS/2 Only)
  88.        1.5.10 Turning Off the Mouse
  89.        1.5.11 Debugging Multiple Processes (OS/2 only)
  90.        1.5.12 Extending EGA Compatibility
  91.        1.5.13 Using Debug Registers (386 Only)
  92.        1.5.14 Enabling Window or Sequential Mode
  93.  1.6  Debugging Large Programs
  94.  1.7  Working with Older Versions of the Assembler
  95.  
  96.  Chapter 2  The CodeView Display
  97.  2.1  Using Window Mode
  98.        2.1.1  Executing Window Commands with the Keyboard
  99.        2.1.2  Executing Window Commands with the Mouse
  100.        2.1.3  Using Menu Selections
  101.        2.1.4  Using On-Line Help
  102.  2.2  Using Sequential Mode
  103.  
  104.  Chapter 3  Using Dialog Commands
  105.  3.1  Entering Commands and Arguments
  106.        3.1.1  Using Special Keys
  107.        3.1.2  Using the Command Buffer
  108.  3.2  Format for CodeView Commands and Arguments
  109.  3.3  Selecting Text for Use with Commands
  110.  
  111.  Chapter 4  CodeView Expressions
  112.  4.1  C Expressions
  113.        4.1.1  C Symbols
  114.        4.1.2  C Constants
  115.        4.1.3  C Strings
  116.  4.2  FORTRAN Expressions
  117.        4.2.1  FORTRAN Symbols
  118.        4.2.2  FORTRAN Constants
  119.        4.2.3  FORTRAN Strings
  120.        4.2.4  FORTRAN Intrinsic Functions
  121.  4.3  BASIC Expressions
  122.        4.3.1  BASIC Symbols
  123.        4.3.2  BASIC Constants
  124.        4.3.3  BASIC Strings
  125.        4.3.4  BASIC Intrinsic Functions
  126.  4.4  Assembly Expressions
  127.  4.5  Line Numbers
  128.  4.6  Registers and Addresses
  129.        4.6.1  Registers
  130.        4.6.2  Addresses
  131.        4.6.3  Address Ranges
  132.  4.7  Memory Operators
  133.        4.7.1  Accessing Bytes (BY)
  134.        4.7.2  Accessing Words (WO)
  135.        4.7.3  Accessing Double Words (DW)
  136.  4.8  Switching Expression Evaluators
  137.  
  138.  Chapter 5  Executing Code
  139.  5.1  Window and Sequential Mode Commands
  140.  5.2  Trace Command
  141.  5.3  Program Step Command
  142.  5.4  Go Command
  143.  5.5  Execute Command
  144.  5.6  Restart Command
  145.  
  146.  Chapter 6  Examining Data and Expressions
  147.  6.1  Display Expression Command
  148.  6.2  The Graphic Display Command
  149.        6.2.1  Invoking the Graphic Display Command
  150.        6.2.2  Changing the Display
  151.  6.3  Examine Symbols Command
  152.  6.4  Dump Commands
  153.        6.4.1  Dump
  154.        6.4.2  Dump Bytes
  155.        6.4.3  Dump ASCII
  156.        6.4.4  Dump Integers
  157.        6.4.5  Dump Unsigned Integers
  158.        6.4.6  Dump Words
  159.        6.4.7  Dump Double Words
  160.        6.4.8  Dump Short Reals
  161.        6.4.9  Dump Long Reals
  162.        6.4.10 Dump 10-Byte Reals
  163.  6.5  Compare Memory Command
  164.  6.6  Search Memory Command
  165.  6.7  Port Input Command
  166.  6.8  Register Command
  167.  6.9  8087 Command
  168.  
  169.  Chapter 7  Managing Breakpoints
  170.  7.1  Breakpoint Set Command
  171.  7.2  Breakpoint Clear Command
  172.  7.3  Breakpoint Disable Command
  173.  7.4  Breakpoint Enable Command
  174.  7.5  Breakpoint List Command
  175.  
  176.  Chapter 8  Managing Watch Statements
  177.  8.1  Watch Statement Commands
  178.  8.2  Setting Watch-Expression and Watch-Memory Statements
  179.  8.3  Setting Watchpoints
  180.  8.4  Setting Tracepoints
  181.  8.5  Deleting Watch Statements
  182.  8.6  Listing Watchpoints and Tracepoints
  183.  8.7  C Examples
  184.  8.8  FORTRAN Examples
  185.  8.9  Assembly Examples
  186.  
  187.  Chapter 9  Examining Code
  188.  9.1  Set Mode Command
  189.  9.2  Unassemble Command
  190.  9.3  View Command
  191.  9.4  Current Location Command
  192.  9.5  Stack Trace Command
  193.  
  194.  Chapter 10  Modifying Code or Data
  195.  10.1  Assemble Command
  196.  10.2  Enter Commands
  197.         10.2.1  Enter Command
  198.         10.2.2  Enter Bytes Command
  199.         10.2.3  Enter ASCII Command
  200.         10.2.4  Enter Integers Command
  201.         10.2.5  Enter Unsigned Integers Command
  202.         10.2.6  Enter Words Command
  203.         10.2.7  Enter Double Words Command
  204.         10.2.8  Enter Short Reals Command
  205.         10.2.9  Enter Long Reals Command
  206.         10.2.10 Enter 10-Byte Reals Command
  207.  10.3  Fill Memory Command
  208.  10.4  Move Memory Command
  209.  10.5  Port Output Command
  210.  10.6  Register Command
  211.  
  212.  Chapter 11  CodeView Control Commands
  213.  11.1  Help Command
  214.  11.2  Quit Command
  215.  11.3  Radix Command
  216.  11.4  Redraw Comm and
  217.  11.5  Screen Exchange Command
  218.  11.6  Search Command
  219.  11.7  Shell Escape Command
  220.  11.8  Tab Set Command
  221.  11.9  Option Command
  222.  11.10 Redirection Commands
  223.         11.10.1  Redirecting CodeView Input
  224.         11.10.2  Redirecting CodeView Output
  225.         11.10.3  Redirecting CodeView Input and Output
  226.         11.10.4  Commands Used with Redirection
  227.  
  228.  Chapter 12  Debugging in Protected Mode
  229.  12.1  Using CodeView in Different Modes
  230.  12.2  Debugging Dynamic-Link Libraries
  231.  12.3  Debugging Multiple Processes
  232.         12.3.1  Viewing Status
  233.         12.3.2  Switching to a Child Process
  234.  12.4  Debugging Multiple Threads
  235.  12.5  The Thread Command
  236.         12.5.1  Legal Values for Specifier
  237.         12.5.2  Legal Values for yCommand
  238.         12.5.3  Entries to the Thread Command
  239.         12.5.4  Effect of Threads on CodeView Commands
  240.  
  241.  Part 2  Utilities
  242.  
  243.  Chapter 13  Linking Object Files with LINK
  244.  13.1  Determining Linker Output
  245.  13.2  Specifying Files for Linking
  246.         13.2.1  Specifying File Names
  247.         13.2.2  Linking with the LINK Command Line
  248.         13.2.3  Linking with the LINK Prompts
  249.         13.2.4  Linking with a Response File
  250.         13.2.5  How LINK Searches for Libraries
  251.         13.2.6  LINK Memory Requirements
  252.  13.3  Specifying Linker Options
  253.         13.3.1  Aligning Segment Data (/A)
  254.         13.3.2  Running in Batch Mode (/BA)
  255.         13.3.3  Producing a .COM File (/BI)
  256.         13.3.4  Preparing for Debugging (/CO)
  257.         13.3.5  Setting the Maximum Allocation Space (/CP)
  258.         13.3.6  Ordering Segments (/DO)
  259.         13.3.7  Controlling Data Loading (/DS)
  260.         13.3.8  Packing Executable Files (/E)
  261.         13.3.9  Optimizing Far Calls (/F)
  262.         13.3.10 Viewing the Options List (/HE)
  263.         13.3.11 Controlling Executable-File Loading (/HI)
  264.         13.3.12 Preparing for Incremental Linking (/INC)
  265.         13.3.13 Displaying Linker Process Information (/INF)
  266.         13.3.14 Including Line Numbers in the Map File (/LI)
  267.         13.3.15 Listing Public Symbols (/M)
  268.         13.3.16 Ignoring Default Libraries (/NOD)
  269.         13.3.17 Ignoring Extended Dictionary (/NOE)
  270.         13.3.18 Disabling Far-Call Optimization (/NOF)
  271.         13.3.19 Preserving Compatibility (/NOG)
  272.         13.3.20 Preserving Case Sensitivity (/NOI)
  273.         13.3.21 Ordering Segments without Inserting NULL Bytes (/NON)
  274.         13.3.22 Disabling Segment Packing (/NOP)
  275.         13.3.23 Setting the Overlay Interrupt (/O)
  276.         13.3.24 Packing Contiguous Data Segments (/PACKC)
  277.         13.3.25 Packing Contiguous Data Segments (/PACKD)
  278.         13.3.26 Padding Code Segments (/PADC)
  279.         13.3.27 Padding Data Segments (/PADD)
  280.         13.3.28 Pausing during Linking (/PAU)
  281.         13.3.29 Specifying User Libraries for Quick Languages (/Q)
  282.         13.3.30 Setting Maximum Number of Segments (/SE)
  283.         13.3.31 Controlling Stack Size (/ST)
  284.         13.3.32 Issuing Fixup Warnings (/W)
  285.  13.4  Selecting Options with the LINK Environment Variable
  286.  13.5  Linker Operation
  287.         13.5.1  Alignment of Segments
  288.         13.5.2  Frame Number
  289.         13.5.3  Order of Segments
  290.         13.5.4  Combined Segments
  291.         13.5.5  Groups
  292.         13.5.6  Fixups
  293.  13.6  Using Overlays
  294.         13.6.1  Restrictions on Overlays
  295.         13.6.2  Overlay-Manager Prompts
  296.  
  297.  Chapter 14  Incremental Linking with ILINK
  298.  14.1  Definitions
  299.  14.2  Guidelines for Using ILINK
  300.  14.3  The Development Process
  301.  14.4  Running ILINK
  302.         14.4.1  Files Required for Using ILINK
  303.         14.4.2  The ILINK Command Line
  304.  14.5  How ILINK Works
  305.  14.6  Incremental Violations
  306.         14.6.1  Changing Libraries
  307.         14.6.2  Exceeding Code/Data Padding
  308.         14.6.3  Moving/Deleting Data Symbols
  309.         14.6.4  Deleting Code Symbols
  310.         14.6.5  Changing Segment Definitions
  311.         14.6.6  Adding CodeView Debugger Information
  312.  
  313.  Chapter 15  Managing Libraries with LIB
  314.  15.1  Managing Libraries
  315.         15.1.1  Managing Libraries with the LIB Command Line
  316.         15.1.2  Managing Libraries with the LIB Prompts
  317.         15.1.3  Managing Libraries with a Response File
  318.         15.1.4  Terminating the LIB Session
  319.  15.2  Performing Library-Management Tasks with LIB
  320.         15.2.1  Creating a Library File
  321.         15.2.2  Changing a Library File
  322.         15.2.3  Adding Library Modules
  323.         15.2.4  Deleting Library Modules
  324.         15.2.5  Replacing Library Modules
  325.         15.2.6  Copying Library Modules
  326.         15.2.7  Moving Library Modules (Extracting)
  327.         15.2.8  Combining Libraries
  328.         15.2.9  Creating a Cross-Reference-Listing File
  329.         15.2.10 Performing Consistency Checks
  330.         15.2.11 Setting the Library-Page Size
  331.  
  332.  Chapter 16  NMAKE
  333.  16.1  Invoking NMAKE
  334.         16.1.1  Using a Command Line to Invoke NMAKE
  335.         16.1.2  Using a Command File to Invoke NMAKE
  336.  16.2  NMAKE Options
  337.  16.3  Description Files
  338.         16.3.1  Description Blocks
  339.         16.3.2  Macros
  340.         16.3.3  Inference Rules
  341.         16.3.4  Directives
  342.         16.3.5  Pseudotargets
  343.  16.4  Response-File Generation
  344.  16.5  Differences between NMAKE and MAKE
  345.  
  346.  Chapter 17  Using Other Utilities
  347.  17.1  Modifying Program Headers with the EXEMOD Utility
  348.  17.2  Enlarging the DOS Environment with the SETENV Utility
  349.  17.3  Saving Memory with the CVPACK Utility
  350.  
  351.  Chapter 18  Linking for Windows and OS/2 Systems
  352.  18.1  Dynamic-Link Libraries
  353.  18.2  Linking without an Import Library
  354.  18.3  Linking with an Import Library
  355.  18.4  Why Use Import Libraries?
  356.  18.5  Advantages of Dynamic Linking
  357.  18.6  Creating Import Libraries with IMPLIB
  358.  
  359.  Chapter 19  Using Module-Definition Files
  360.  19.1  Module Statements
  361.  19.2  The NAME Statement
  362.  19.3  The LIBRARY Statement
  363.  19.4  The DESCRIPTION Statement
  364.  19.5  The CODE Statement
  365.  19.6  The DATA Statement
  366.  19.7  The SEGMENTS Statement
  367.  19.8  The STACKSIZE Statement
  368.  19.9  The EXPORTS Statement
  369.  19.10 The IMPORTS Statement
  370.  19.11 The STUB Statement
  371.  19.12 The HEAPSIZE Statement
  372.  19.13 The PROTMODE Statement
  373.  19.14 The OLD Statement
  374.  19.15 The REALMODE Statement
  375.  19.16 The EXETYPE Statement
  376.  
  377.  Chapter 20  Creating Dual-Mode Programs with BIND
  378.  20.1  Binding Library Routines
  379.  20.2  Binding Functions as Protected Mode Only
  380.  20.3  The BIND Command Line
  381.  20.4  BIND Operation
  382.  20.5  Executable-File Layout
  383.  20.6  How to Build a Dual-Mode Application
  384.  
  385.  Chapter 21  Using EXEHDR
  386.  21.1  The EXEHDR Command Line
  387.  21.2  EXEHDR Output
  388.  21.3  Output in Verbose Mode
  389.  
  390.  Appendix A  Regular Expressions
  391.  A.1  Special Characters in Regular Expressions
  392.  A.2  Searching for Special Characters
  393.  A.3  Using the Period
  394.  A.4  Using Brackets
  395.        A.4.1  Using the Dash within Brackets
  396.        A.4.2  Using the Caret within Brackets
  397.        A.4.3  Matching Brackets within Brackets
  398.  A.5  Using the Asterisk
  399.  A.6  Matching the Start or End of a Line
  400.  
  401.  Appendix B  Using Exit Codes
  402.  B.1  Exit Codes with NMAKE
  403.  B.2  Exit Codes with DOS Batch Files
  404.  B.3  Exit Codes for Programs
  405.        B.3.1  LINK Exit Codes
  406.        B.3.2  LIB Exit Codes
  407.        B.3.3  NMAKE Exit Codes
  408.        B.3.4  EXEMOD and SETENV Exit Codes
  409.        B.3.5  CVPACK Exit Codes
  410.  
  411.  Appendix C  Error Messages
  412.  C.1  CodeView Error Messages
  413.  C.2  LINK Error Messages
  414.        C.2.1  LINK Fatal Error Messages
  415.        C.2.2  LINK Nonfatal Error Messages
  416.        C.2.3  LINK Warning Messages
  417.  C.3  ILINK Error Messages
  418.        C.3.1  ILINK Fatal Errors
  419.        C.3.2  Incremental Violations
  420.        C.3.3  ILINK Warning Messages
  421.  C.4  LIB Error Messages
  422.        C.4.1  Fatal LIB Error Messages
  423.        C.4.2  Nonfatal LIB Error Messages
  424.        C.4.3  Warning LIB Error Messages
  425.  C.5  NMAKE Error Messages
  426.        C.5.1  Fatal NMAKE Error Messages
  427.        C.5.2  Warning NMAKE Error Messages
  428.  C.6  EXEMOD Error Messages
  429.        C.6.1  Fatal EXEMOD Error Messages
  430.        C.6.2  Warning EXEMOD Error Messages
  431.  C.7  SETENV Error Messages
  432.  
  433.  Glossary
  434.  
  435.  Index
  436.  
  437.  Tables
  438.  Table 1.1  Default Exchange and Display Modes
  439.  Table 4.1  CodeView C Expression Operators
  440.  Table 4.2  C Radix Examples
  441.  Table 4.3  CodeView FORTRAN Operators
  442.  Table 4.4  FORTRAN Radix Examples
  443.  Table 4.5  FORTRAN Intrinsic Functions Supported by the CodeView Debugger
  444.  Table 4.6  CodeView BASIC Operators
  445.  Table 4.7  BASIC Radix Examples
  446.  Table 4.8  BASIC Intrinsic Functions Supported by the CodeView Debugger
  447.  Table 4.9  Registers
  448.  Table 6.1  CodeView Format Specifiers
  449.  Table 10.1 Flag-Value Mnemonics
  450.  Table 16.1 Predefined Inference Rules
  451.  
  452.  
  453.  Introduction
  454.  ───────────────────────────────────────────────────────────────────────────
  455.  
  456.  Welcome to the Microsoft(R) CodeView(R) debugger and development utilities.
  457.  These are executable programs that help you develop software written with
  458.  the Microsoft BASIC, C, FORTRAN, and Pascal compilers, as well as with the
  459.  Microsoft Macro Assembler.
  460.  
  461.  The Microsoft CodeView debugger is a powerful, window-oriented tool that
  462.  enables you to track down logical errors in programs; it allows you to
  463.  analyze a program as the program is actually running. The CodeView debugger
  464.  will display source code or assembly code, indicate which line is about to
  465.  be executed, dynamically watch the values of variables (local or global),
  466.  switch screens to display program output, and perform many other related
  467.  functions. The debugger can be easily learned and used by assembly and
  468.  high-level-language programmers alike.
  469.  
  470.  The utilities are important at various stages of software development. After
  471.  you use a compiler or assembler to produce one or more object files, use
  472.  LINK to produce an executable file. (When a program is made into an
  473.  executable file, it is finally in the form that can be loaded and executed
  474.  by DOS.) In the process of linking, you may use software libraries. The LIB
  475.  utility enables you to create, examine, and maintain these libraries. The
  476.  process of compiling and linking can be automated──to a large degree──with
  477.  the MAKE utility; MAKE keeps track of which source files have been changed,
  478.  and then executes just the commands necessary to update the program.
  479.  
  480.  Other utilities help you maintain executable files once they have been
  481.  created. You can use EXEMOD to examine or modify the file's header. The
  482.  executable-file header indicates stack size, load size, and other important
  483.  items used by DOS each time it executes the file.
  484.  
  485.  Finally, you can use the SETENV and ERROUT utilities to modify the DOS
  486.  environment itself.
  487.  
  488.  ───────────────────────────────────────────────────────────────────────────
  489.  NOTE
  490.     Microsoft documentation uses the term "OS/2" to refer to the OS/2
  491.     systems──Microsoft(R) OperatingSystem/2 (MS(R) OS/2) and IBM(R) OS/2.
  492.     Similarly, the term "DOS" refers to both the MS-DOS(R) and IBM Personal
  493.     Computer DOS operating systems. The name of a specific operating system
  494.     is used when it is necessary to note features that are unique to that
  495.     system.
  496.  ───────────────────────────────────────────────────────────────────────────
  497.  
  498.  
  499.  New Features of the CodeView(R) Debugger
  500.  
  501.    ■  Structure, pointer, and array display
  502.  
  503.       A new dialog box supports visual display of structures and arrays. Each
  504.       member or element is displayed. You can also use this dialog box to
  505.       examine local variables and nested structures and to trace pointer
  506.       references.
  507.  
  508.    ■  Multilanguage expression evaluation
  509.  
  510.       The CodeView debugger has a built-in language interpreter that can
  511.       evaluate either C, BASIC, or FORTRAN expressions.
  512.  
  513.    ■  386 support
  514.  
  515.       The CodeView debugger now supports debugging of code written
  516.       specifically for the 386 processor. You can now decode and assemble 386
  517.       instructions, as well as view 386 registers.
  518.  
  519.    ■  Expanded memory support
  520.  
  521.       If you have expanded memory, you can substantially reduce the amount of
  522.       main memory required to debug a program. Many programs that were
  523.       previously too large can now be run with the CodeView debugger.
  524.  
  525.    ■  8087 emulator support
  526.  
  527.       If you do not have an 8087 coprocessor in your machine, you can link to
  528.       a Microsoft emulator library and take advantage of the 7 command. The
  529.       debugger will display pseudo-8087 registers, as if you did have a math
  530.       coprocessor in your machine.
  531.  
  532.    ■  Overlays and library modules
  533.  
  534.       The debugger is now fully compatible with programs that use overlays.
  535.       You can also debug library modules.
  536.  
  537.    ■  New commands
  538.  
  539.       The SYMDEB (symbolic debugger) commands──Compare, Fill, Move, Input,
  540.       and Output──have been added to the CodeView debugger's repertoire. The
  541.       Option command provides more power for redirected input and start-up
  542.       commands.
  543.  
  544.  
  545.  About this Manual
  546.  
  547.  This manual is intended as a companion volume to Microsoft language manuals.
  548.  It is not language specific, except where examples are required; and in
  549.  those cases, examples from several languages are typically given.
  550.  
  551.  The manual is divided into two parts, followed by appendixes: Part 1
  552.  (chapters 1-12) explains how to use the CodeView debugger to examine and
  553.  locate program errors; Part 2 (chapters 13-21) explains how to use each of
  554.  the utilities, including LINK, ILINK, LIB, NMAKE, EXEMOD, SETENV, and BIND.
  555.  The appendixes at the end of the manual discuss exit codes and error
  556.  messages for the CodeView debugger and all the utilities.
  557.  
  558.  The following list indicates where to find different kinds of information in
  559.  the manual. The list is by no means exhaustive, but is intended to serve as
  560.  a starting place, particularly for the new user of the CodeView debugger.
  561.  
  562.  
  563. ╓┌───────────────────────────┌───────────────────────────────────────────────
  564.  Information                 Location
  565.  
  566.  Examining and locating      Part 1 (chapters 1-12), "The CodeView Debugger,"
  567.  program errors              describes methods to help you track down errors
  568.                              in a program and analyze it while it runs. Exit
  569.  Information                 Location
  570.  
  571.                             in a program and analyze it while it runs. Exit
  572.                              codes and error messages are discussed in the
  573.                              appendixes at the back of this manual.
  574.  
  575.  Starting a debugging        Chapter 1, "Getting Started," tells you how
  576.  session                     to compile and link programs so that you can run
  577.                              them with the debugger. It also explains each
  578.                              CodeView command-line option.
  579.  
  580.  Using the CodeView          Chapter 2, "The CodeView Display," describes
  581.  interface                   how to use the CodeView windows, pop-up menus,
  582.                              and the mouse.
  583.  
  584.  Specifying the CodeView     Chapter 3, "Using Dialog Commands," presents the
  585.  commands                    general form of commands, while Chapter 4,
  586.                              "CodeView Expressions," describes how to build
  587.                              complex expressions for use in commands.
  588.  
  589.  Controlling execution       Chapter 5, "Executing Code," explains the basics
  590.  Information                 Location
  591.  
  592. Controlling execution       Chapter 5, "Executing Code," explains the basics
  593.  of your program             of controlling program execution with the
  594.                              CodeView debugger; Chapter 7, "Managing
  595.                              Breakpoints," explains how to use breakpoints to
  596.                              suspend execution.
  597.  
  598.  Watching the value of       Chapter 6, "Examining Data and Expressions,"
  599.  variables or                shows how to display values; Chapter 8,
  600.  expressions                 "Managing Watch Statements," shows how to place
  601.                              variables in a window where you can watch their
  602.                              values change as the program runs.
  603.  
  604.  Using the utilities         Part 2 (chapters 13-21), "Utilities," describes
  605.                              the various utilities for producing and
  606.                              maintaining executable files, and for other
  607.                              tasks. Exit codes and error messages for the
  608.                              utilities are discussed in the appendixes at the
  609.                              back of this manual.
  610.  
  611.  Information                 Location
  612.  
  613. 
  614.  Creating executable         Chapter 13, "Linking Object Files with LINK."
  615.  files
  616.  
  617.  Using the incremental       Chapter 14, "Incremental Linking with ILINK."
  618.  linker for faster
  619.  linking
  620.  
  621.  Managing software           Chapter 15, "Managing Libraries with LIB."
  622.  libraries
  623.  
  624.  Automating projects         Chapter 16, "NMAKE."
  625.  that have several
  626.  modules
  627.  
  628.  Using EXEMOD, SETENV,       Chapter 17, "Using Other Utilities."
  629.  and CVPACK
  630.  
  631.  Dynamic linking under       Chapter 18, "Linking for Windows and OS/2
  632.  Information                 Location
  633.  
  634. Dynamic linking under       Chapter 18, "Linking for Windows and OS/2
  635.  OS/2                        Systems."
  636.  
  637.  Module-definition           Chapter 19, "Using Module-Definition Files."
  638.  statements
  639.  
  640.  Binding programs to run     Chapter 20, "Creating Dual-Mode Programs with
  641.  under both protected        BIND."
  642.  mode and real mode
  643.  
  644.  Viewing the contents of     Chapter 21, "Using EXEHDR."
  645.  a segmented .EXE file
  646.  header
  647.  
  648.  Specifying expressions      Appendix A, "Regular Expressions."
  649.  for the CodeView Search
  650.  command
  651.  
  652.  Codes returned to DOS       Appendix B, "Exit Codes."
  653.  Information                 Location
  654.  
  655. Codes returned to DOS       Appendix B, "Exit Codes."
  656.  by each utility
  657.  
  658.  A list of error             Appendix C, "Error Messages."
  659.  messages
  660.  
  661.  
  662.  ───────────────────────────────────────────────────────────────────────────
  663.  Important
  664.     There may be additional information about the CodeView debugger in the
  665.     README.DOC file. This file will describe changes made to the program
  666.     after the manual was printed.
  667.  ───────────────────────────────────────────────────────────────────────────
  668.  
  669.  
  670.  Document Conventions
  671.  
  672.  The following document conventions are used throughout this manual and apply
  673.  in particular to syntax displays.
  674.  
  675.  
  676. ╓┌───────────────────────────┌───────────────────────────────────────────────
  677.  Example                     Description
  678.  
  679.  BP                          Boldface type always marks standard features of
  680.                              either programming languages (keywords,
  681.                              operators, and functions) or CodeView
  682.                              sequential-mode commands.
  683.  
  684.                              These terms and punctuation marks must be typed
  685.                              exactly as shown in order to have effect.
  686.                              However, the use of uppercase or lowercase
  687.                              letters is not always significant.
  688.                              Case-sensitive terms are noted in text.
  689.  
  690.  number                      Placeholders are words in italics that indicate
  691.                              a general kind of information; you are expected
  692.                              to provide the actual value. For example,
  693.                              consider the syntax display for the CodeView
  694.                              Radix command:
  695.  Example                     Description
  696.  
  697.                             Radix command:
  698.  
  699.                              Nnumber
  700.  
  701.                              This syntax display asks that you enter the
  702.                              Radix command by typing N, immediately followed
  703.                              by some value for number. You could, for
  704.                              example, type in the entry N8; but you could not
  705.                              legally type in the word "number" itself.
  706.  
  707.  Word Ptr                    This font is used to indicate all example
  708.                              programs, user input, and screen output.
  709.  
  710.  Program . . . Fragment      A column of three dots tells you part of a
  711.                              program has been intentionally omitted.
  712.  
  713.  «optional items»            Double brackets enclose optional fields in
  714.                              command-line and option syntax. Consider the
  715.                              following command-line syntax:
  716.  Example                     Description
  717.  
  718.                             following command-line syntax:
  719.  
  720.                              R «register» ««=»value»
  721.  
  722.                              The double brackets around the placeholders
  723.                              indicate that you may enter a register and you
  724.                              may enter a value. The equal sign (=) indicates
  725.                              that you may place an equal sign before the
  726.                              value, but only if you specify a value.
  727.  
  728.  «choice1 | choice2»         The vertical bar indicates that you may enter
  729.                              one of the entries shown on either side of the
  730.                              bar. The following command-line syntax
  731.                              illustrates the use of a vertical bar:
  732.  
  733.                              DB «address | range»
  734.  
  735.                              The bar indicates that following the Dump Bytes
  736.                              command (DB), you can specify either an address
  737.  Example                     Description
  738.  
  739.                             command (DB), you can specify either an address
  740.                              or range. Since both are in double brackets, you
  741.                              can also give the command with no argument.
  742.  
  743.  "Watch point"               The first time a new term is defined, it is
  744.                              enclosed in quotation marks.
  745.  
  746.  ALT                         Small capital letters are used for the names of
  747.                              keys and key sequences, such as ENTER, CTRL+C,
  748.                              and ALT+F.
  749.  
  750.  Sample screens              Sample screens are shown in black and white.
  751.                              Your screens will look like this if you have a
  752.                              monochrome monitor, or if you use the /B option
  753.                              in the CodeView command line (see Section 1.5.4,
  754.                              "Starting with a Black-and-White Display").
  755.  
  756.  
  757.  
  758.  ───────────────────────────────────────────────────────────────────────────
  759.  Part 1  The CodeView Debugger
  760.  
  761.  Part 1 explains the use of the CodeView debugger. Commands, display, and
  762.  interface of the debugger are presented here, while other material relevant
  763.  to the debugger such as error messages and exit codes is presented in the
  764.  Appendixes.
  765.  
  766.  Chapter 1 explains how to create a C, Fortran, BASIC, Pascal or assembly
  767.  program that can be run with CodeView; it also explains how to start the
  768.  debugger and select various command-line options.
  769.  
  770.  Chapter 2 discusses the CodeView display screen and interface, including
  771.  function keys, keyboard commands, and the mouse.
  772.  
  773.  Chapters 3-12 of Part 1 describe how to use each of the CodeView commands
  774.  and expressions.
  775.  
  776.  
  777.  Chapter 1  Getting Started
  778.  ───────────────────────────────────────────────────────────────────────────
  779.  
  780.  Getting started with the CodeView debugger requires several simple steps.
  781.  First you must prepare a special-format executable file for the program you
  782.  wish to debug; then you can invoke the debugger. You may also wish to
  783.  specify options that will affect the debugger's operation.
  784.  
  785.  This chapter describes how to produce executable files in the CodeView
  786.  format using C, FORTRAN, BASIC, Pascal, or assembly language and describes
  787.  how to load a program into the CodeView debugger. The chapter lists
  788.  restrictions and programming considerations with regard to the debugger,
  789.  which you may want to consult before compiling or assembling. Finally, the
  790.  chapter describes how to use the debugger with Microsoft or IBM Macro
  791.  Assembler, Versions 1.0 through 4.0.
  792.  
  793.  
  794.  1.1  Restrictions
  795.  
  796.  This list describes files that are not directly supported by the debugger.
  797.  The following restrictions apply generally to the use of the CodeView
  798.  debugger, regardless of the language being used.
  799.  
  800.  Restriction                 Explanation
  801.  
  802.  Include files               You will not be able to use the CodeView
  803.                              debugger to debug source code in include files.
  804.  
  805.  Packed files                CodeView symbolic information cannot be put into
  806.                              a packed file.
  807.  
  808.  .COM files                  Files with the extension .COM can be debugged in
  809.                              assembly mode only; they can never contain
  810.                              symbolic information.
  811.  
  812.  Memory-resident             The CodeView debugger can only work with
  813.  programs                    disk-resident .EXE and .COM files. Debugging of
  814.                              memory-resident files is not supported.
  815.  
  816.  Programs that alter the     Programs that run under the CodeView debugger
  817.  environment                 can read the DOS environment, but they cannot
  818.                              permanently change it. Upon exit from CodeView,
  819.                              all changes to the environment are lost.
  820.  
  821.  Program Segment Prefix      The CodeView debugger automatically preprocesses
  822.  (PSP)                       a program's PSP the same way a C program does;
  823.                              quote marks are removed, and exactly one space
  824.                              is left between command-line arguments. This
  825.                              preprocessing only creates a problem if you are
  826.                              debugging a program not written in C──one that
  827.                              tries to access command-line arguments.
  828.  
  829.  Some of the features now allowed by CodeView include debugging of library
  830.  modules and debugging of overlaid code.
  831.  
  832.  
  833.  1.2  The CodeView Environment
  834.  
  835.  Work with CodeView can be optimized in several ways.
  836.  
  837.  The CVPACK utility compresses CodeView information in an executable file.
  838.  See Section 17.4 for directions on how to use CVPACK.
  839.  
  840.  In addition, the /E option enables CodeView to take advantage of expanded
  841.  memory. Command-line options are described in Section 1.5.
  842.  
  843.  
  844.  1.3  Preparing Programs for the CodeView Debugger
  845.  
  846.  You must compile and link with the correct options in order to use a program
  847.  with the CodeView debugger. These options direct the compiler and the linker
  848.  to produce an executable file, which contains line-number information and a
  849.  symbol table, in addition to the executable code.
  850.  
  851.  ───────────────────────────────────────────────────────────────────────────
  852.  NOTE
  853.     For the sake of brevity, Sections 1.3.1-1.3.3 use the term "compiling"
  854.     to refer to the process of producing object modules. However, almost
  855.     everything said about compiling in this section applies equally well to
  856.     assembling. Exceptions are noted in Section 1.3.8, "Preparing Assembly
  857.     Programs."
  858.  ───────────────────────────────────────────────────────────────────────────
  859.  
  860.  Not all compiler and linker versions support CodeView options. (See the
  861.  section on the appropriate language below for information about compiler
  862.  versions.) Also, you will need to use the Microsoft Overlay Linker (Version
  863.  3.6 or later) or the Microsoft Segmented-Executable Linker. If you try to
  864.  debug an executable file that was not compiled and linked with CodeView
  865.  options, or if you use a compiler that does not support these options, then
  866.  you will only be able to use the debugger in assembly mode. This means the
  867.  CodeView debugger will not be able to display source code or understand
  868.  source-level symbols, such as symbols for functions and variables.
  869.  
  870.  
  871.  1.3.1  Programming Considerations
  872.  
  873.  Any source code that is legal in C, FORTRAN, BASIC, Pascal, or Microsoft
  874.  Macro Assembler can be compiled or assembled to create an executable file
  875.  and then debugged with the CodeView debugger. However, some programming
  876.  practices make debugging more difficult.
  877.  
  878.  Each of the Microsoft languages listed above permits you to put code in
  879.  separate include files and read the files into your source file by using an
  880.  include directive. However, you will not be able to use the CodeView
  881.  debugger to debug source code in include files. The preferred method of
  882.  developing programs is to create separate object modules and then link the
  883.  object modules with your program. The CodeView debugger supports the
  884.  debugging of separate object modules in the same session.
  885.  
  886.  Also, the CodeView debugger is more effective and easier to use if you put
  887.  each source statement on a separate line. A number of languages (C and BASIC
  888.  in particular) permit you to place more than one statement on a single line
  889.  of the source file. This practice does not prevent the CodeView debugger
  890.  from functioning. However, the debugger must treat the line as a single
  891.  unit; it cannot break the line down into separate statements. Therefore, if
  892.  you have three statements on the same line, you will not be able to put a
  893.  breakpoint or freeze execution on the individual statements. The best you
  894.  will be able to do is to freeze execution at the beginning of the three
  895.  statements or at the beginning of the next line.
  896.  
  897.  Some languages (C and assembly in particular) support a type of macro
  898.  expansion. However, the CodeView debugger will not help you debug macros in
  899.  source mode. You will need to expand the macros yourself before debugging
  900.  them; otherwise, the debugger will treat them as simple statements or
  901.  instructions.
  902.  
  903.  Finally, your segments should be declared according to the standard
  904.  Microsoft format (as described in the Microsoft Mixed-Language Programming
  905.  Guide). This is taken care of for you automatically with each of the
  906.  Microsoft high-level languages.
  907.  
  908.  
  909.  1.3.2  CodeView Compile Options
  910.  
  911.  Microsoft compilers accept command-line options preceded by either a forward
  912.  slash (/) or a dash (-). For brevity, this manual lists only the forward
  913.  slash when describing options, but you may use either symbol.
  914.  
  915.  The use of uppercase or lowercase letters is significant for options used
  916.  with the C, FORTRAN, BASIC, and Pascal compilers; you must type the letters
  917.  exactly as given.
  918.  
  919.  When you compile a source file for a program you want to debug, you must
  920.  specify the /Zi option on the command line. The /Zi option instructs the
  921.  compiler to include line-number and symbolic information in the object file.
  922.  
  923.  If you do not need complete symbolic information in some modules, you can
  924.  compile those modules with the /Zd option instead of /Zi. The /Zd option
  925.  writes less symbolic information to the object file, so using this option
  926.  will save disk space and memory. For example, if you are working on a
  927.  program made up of five modules, but only need to debug one module, you can
  928.  compile that module with the /Zi option and the other modules with the /Zd
  929.  option. You will be able to examine global variables and see source lines in
  930.  modules compiled with the /Zd option, but local variables will be
  931.  unavailable.
  932.  
  933.  In addition, if you are working with a high-level language, you will
  934.  probably want to use the /Od option, which turns off optimization. Optimized
  935.  code may be rearranged for greater efficiency and, as a result, the
  936.  instructions in your program may not correspond closely to the source lines.
  937.  After debugging, you can compile a final version of the program with the
  938.  optimization level you prefer.
  939.  
  940.  ───────────────────────────────────────────────────────────────────────────
  941.  NOTE
  942.     The /Zd option is not available with QuickBASIC. The /Od option is not
  943.     available with QuickBASIC or the Macro Assembler.
  944.  ───────────────────────────────────────────────────────────────────────────
  945.  
  946.  You cannot debug a program until you compile it successfully. The CodeView
  947.  debugger will not help you correct syntax or compiler errors. Once you
  948.  successfully compile your program, you can use the debugger to locate
  949.  logical errors in the program.
  950.  
  951.  Compiling examples are given in the sections below on compiling and linking
  952.  with specific languages.
  953.  
  954.  
  955.  1.3.3  CodeView Link Options
  956.  
  957.  If you use LINK separately to link an object file or files for debugging,
  958.  you should specify the /CODEVIEW option (it can be abbreviated as /CO). This
  959.  instructs the linker to incorporate addresses for symbols and source lines
  960.  into the executable file.
  961.  
  962.  If you use a Microsoft driver program that automatically invokes the linker
  963.  (such as CL with C, or FL with FORTRAN), the linker is automatically invoked
  964.  with the /CO option whenever you specify /Zi on the command line. You do not
  965.  use /CO unless you are invoking the linker directly, by typing LINK.
  966.  
  967.  Although executable files prepared with the /CODEVIEW option can be
  968.  executed from the DOS command line like any other executable files, they
  969.  are larger because of the extra symbolic information in them. To minimize
  970.  program size, you will probably want to recompile and link your final
  971.  version without the /Zi option when you finish debugging a program.
  972.  
  973.  Linking examples are given in the sections below on compiling and linking
  974.  with specific languages.
  975.  
  976.  
  977.  1.3.4  Preparing C Programs
  978.  
  979.  In order to use the CodeView debugger with a program written in C, you need
  980.  to compile it with the Microsoft C Compiler, Version 4.0 or later. Earlier
  981.  versions of the compiler do not support the CodeView compile options. You
  982.  also need to link with the Microsoft Overlay Linker, Version 3.6 or later.
  983.  
  984.  Writing C Source Code
  985.  
  986.  Microsoft C supports the use of include files through the use of the
  987.  #include directive. However, you will not be able to debug source code put
  988.  into include files. Therefore, you should reserve the use of include files
  989.  for #define prototypes, macros, and structure definitions.
  990.  
  991.  The C language permits you to put more than one statement on a line. This
  992.  practice makes it difficult for you to debug such lines of code. For
  993.  example, the following code is legal in C:
  994.  
  995.       code = buffer[count]; if (code == '\n') ++lines;
  996.  
  997.  This code is made up of three separate source statements. When placed on the
  998.  same line, the individual statements cannot be accessed during debugging.
  999.  You could not, for example, stop program execution at ++lines;. The same
  1000.  code would be easier to debug in the following form:
  1001.  
  1002.       code = buffer[count];
  1003.       if (code == '\n')
  1004.               ++lines;
  1005.  
  1006.  This makes code easier to read and corresponds with what is generally
  1007.  considered good programming practice.
  1008.  
  1009.  You cannot easily debug macros with the CodeView debugger. The debugger will
  1010.  not break down the macro for you. Therefore, if you have complex macros with
  1011.  potential side effects, you may need to write them first as regular source
  1012.  statements.
  1013.  
  1014.  Compiling and Linking C Programs
  1015.  
  1016.  The /Zi, /Zd, and /Od options are all supported by the Microsoft C
  1017.  Compilers, Versions 4.0 and later. (For a description of these options, see
  1018.  Section 1.3.2, "CodeView Compile Options.") The options are accepted by the
  1019.  CL driver and the  MSC driver, which was supplied with Version 4.0. Linking
  1020.  separately with /CO is necessary when you compile with MSC.
  1021.  
  1022.  The CodeView debugger supports mixed-language programming. For an example of
  1023.  how to link a C module with modules from other languages, see Section 1.3.8,
  1024.  "Preparing Assembly Programs."
  1025.  
  1026.  Examples
  1027.  
  1028.       CL /Zi /Od EXAMPLE.C
  1029.  
  1030.       CL /Zi /Od /c EXAMPLE.C
  1031.       LINK /CO EXAMPLE;
  1032.  
  1033.       CL /Zi /Od /c MOD1.C
  1034.       CL /Zd /Od /c MOD2.C
  1035.       CL /Zi MOD1 MOD2
  1036.  
  1037.  In the first example, CL is used to compile and link EXAMPLE.C, the source
  1038.  file. The CL driver creates an object file, EXAMPLE.OBJ, in the CodeView
  1039.  format, and then automatically invokes the linker with the /CO option. The
  1040.  second example demonstrates how to compile and link source file EXAMPLE.C by
  1041.  using the MSC program provided with Version 4.0 of the compiler. Since MSC
  1042.  does not invoke the linker, you must invoke the linker directly and specify
  1043.  /CO on the command line. Both examples will result in an executable file,
  1044.  EXAMPLE.EXE, which has the line-number information, symbol table, and
  1045.  unoptimized code required by the CodeView debugger.
  1046.  
  1047.  In the third example, the source module MOD1.C is compiled to produce an
  1048.  object file with full symbolic and line information, while MOD2.C is
  1049.  compiled to produce an object file with limited information. Then, CL is
  1050.  used again to link the resulting object files. (This time, CL does not
  1051.  recompile because the arguments have no .C extension.) Typing /Zi on the
  1052.  command line causes the linker to be invoked with the /CO option. The result
  1053.  is an executable file in which one of the modules, MOD2.C, will be harder to
  1054.  debug. However, the executable file will take up less space on disk than it
  1055.  would if both modules were compiled with full symbolic information.
  1056.  
  1057.  
  1058.  1.3.5  Preparing FORTRAN Programs
  1059.  
  1060.  In order to use the CodeView debugger with a program written in FORTRAN, you
  1061.  will need to compile it with the Microsoft FORTRAN Compiler, Version 4.0 or
  1062.  later. Earlier versions of the compiler do not support CodeView compile
  1063.  options. You will also need to link with the Microsoft Overlay Linker,
  1064.  Version 3.6 or later.
  1065.  
  1066.  Writing FORTRAN Source Code
  1067.  
  1068.  The Microsoft FORTRAN Compiler supports the use of include files, through
  1069.  use of the $INCLUDE directive. However, you will not be able to debug source
  1070.  code in an include file. If you have source code that you wish to put in
  1071.  separate files, then you should use the technique of separately compiled
  1072.  modules. The CodeView debugger does support this technique by allowing you
  1073.  to trace through separate source files in the same session.
  1074.  
  1075.  Compiling and Linking FORTRAN Programs
  1076.  
  1077.  The /Zi, /Zd, and /Od options are all supported by the Microsoft FORTRAN
  1078.  Compiler, Version 4.0 or later. For a description of these options, see
  1079.  Section 1.3.2, "CodeView Compile Options." The CodeView debugger supports
  1080.  mixed-language programming. For an example of how to link a FORTRAN module
  1081.  with modules from other languages, see Section 1.3.8, "Preparing Assembly
  1082.  Programs."
  1083.  
  1084.  Examples
  1085.  
  1086.       FL /Zi /Od EXAMPLE.FOR
  1087.  
  1088.       FL /Zi /Od /c EXAMPLE.FOR
  1089.       LINK /CO EXAMPLE;
  1090.  
  1091.       FL /Zi /Od /c MOD1.FOR
  1092.       FL /Zd /Od /c MOD2.FOR
  1093.       FL /Zi MOD1 MOD2
  1094.  
  1095.  In the first example, the FL driver is used to compile and link the source
  1096.  file EXAMPLE.FOR. The FL driver creates an object file in the CodeView
  1097.  format, EXAMPLE.OBJ, and then automatically invokes the linker with the /CO
  1098.  option. The second example demonstrates how to compile and link the source
  1099.  file EXAMPLE.FOR by using separate steps for compiling and linking. In this
  1100.  case, the /CO option must be given explicitly to the linker. Both examples
  1101.  result in an executable file, EXAMPLE.EXE, which has the line-number
  1102.  information, symbol table, and unoptimized code required by the CodeView
  1103.  debugger.
  1104.  
  1105.  In the third example, the source module MOD1.FOR is compiled to produce an
  1106.  object file with full symbolic and line information, while MOD2.FOR is
  1107.  compiled to produce an object file with limited information. Then FL is used
  1108.  again to link the object files. (Note that this time, FL does not recompile
  1109.  because the arguments have no .FOR extension.) Typing /Zi on the command
  1110.  line causes the linker to be invoked with the /CO option. The result is an
  1111.  executable file in which one of the modules, MOD2.FOR, will be harder to
  1112.  debug. However, the executable file takes up less space on disk than it
  1113.  would if both modules were compiled with full symbolic information.
  1114.  
  1115.  
  1116.  1.3.6  Preparing BASIC Programs
  1117.  
  1118.  In order to use the CodeView debugger with a program written in BASIC, you
  1119.  will need to compile it with Microsoft QuickBASIC, Version 4.0 or later. You
  1120.  will also need to link with the Microsoft Overlay Linker, Version 3.6 or
  1121.  later.
  1122.  
  1123.  Writing BASIC Source Code
  1124.  
  1125.  Microsoft BASIC supports the use of include files, through the use of the
  1126.  $INCLUDE directive. However, you will not be able to debug source code put
  1127.  into include files. The preferred practice for developing source code in
  1128.  separate files is to use separately compiled modules. The CodeView debugger
  1129.  does support this technique by allowing you to trace through separate source
  1130.  files in the same session.
  1131.  
  1132.  BASIC also permits you to put more than one statement on a line. This
  1133.  practice makes it difficult for you to debug such lines of code. For
  1134.  example, the following code is legal, even common, in BASIC:
  1135.  
  1136.       SUM=0 : FOR I=1 TO N : SUM=SUM+ARRAY(I) : NEXT I
  1137.  
  1138.  This code is actually made up of four separate BASIC statements. When placed
  1139.  on the same line, the individual statements cannot be accessed during
  1140.  debugging. You could not, for example, stop program execution at SUM=SUM+
  1141.  ARRAY(I). The same code would be easier to debug if it were written in the
  1142.  following form:
  1143.  
  1144.       SUM=0
  1145.       FOR I=1 TO N
  1146.           SUM=SUM+ARRAY(I)
  1147.       NEXT I
  1148.  
  1149.  Compiling and Linking BASIC Programs
  1150.  
  1151.  Microsoft QuickBASIC Versions 4.0 and later can prepare BASIC programs for
  1152.  use with the CodeView debugger, through the use of the BC command line.
  1153.  
  1154.  You cannot prepare programs for use with CodeView when you are in the
  1155.  QuickBASIC editor itself. Instead, compile separately with the BC
  1156.  command-line option /Zi. The /Zi option is described in Section 1.3.2,
  1157.  "CodeView Compile Options." You must also link separately with /CO.
  1158.  
  1159.  The CodeView debugger supports mixed-language programming. For an example of
  1160.  how to link a BASIC module with modules from other languages, see Section
  1161.  1.3.8, "Preparing Assembly Programs."
  1162.  
  1163.  Example
  1164.  
  1165.       BC /Zi EXAMPLE;
  1166.       LINK /CO EXAMPLE;
  1167.  
  1168.  The example above compiles the source file EXAMPLE.BAS to produce an object
  1169.  file, EXAMPLE.OBJ, which contains the symbol and line-number information
  1170.  required by the CodeView debugger. Then the linker is invoked with the /CO
  1171.  option to create an executable file that can be used with the debugger.
  1172.  
  1173.  
  1174.  1.3.7  Preparing Pascal Programs
  1175.  
  1176.  In order to use the CodeView debugger with a program written in Pascal, you
  1177.  need to compile it with the Microsoft Pascal Compiler, Version 4.0 or later.
  1178.  Earlier versions of Pascal do not support the CodeView compile options. You
  1179.  also need to link with the Microsoft Overlay Linker, Version 3.6 or later.
  1180.  
  1181.  ───────────────────────────────────────────────────────────────────────────
  1182.  NOTE
  1183.     If you have a version of Microsoft Pascal earlier than Version 4.0, you
  1184.     can use the CodeView debugger to a limited extent. However, the debugger
  1185.     will not be able to evaluate program symbols in CodeView commands.
  1186.     Compile a program as you would normally, and then link with the /CO
  1187.     option as explained below. You will then be able to use CodeView to step
  1188.     through your program and set breakpoints.The debugger will also be able
  1189.     to display machine-level code and domemory dumps. This version of Code
  1190.     View does not include a Pascal expression evaluator.
  1191.  ───────────────────────────────────────────────────────────────────────────
  1192.  
  1193.  Writing Pascal Source Code
  1194.  
  1195.  Microsoft Pascal supports the use of include files by providing the $include
  1196.  metacommand. However, you will not be able to debug source code put into
  1197.  include files. You can easily debug code in separately compiled source
  1198.  files. Use this technique, rather than that of include files, to debug a
  1199.  large program.
  1200.  
  1201.  Pascal allows you to put more than one statement on a line; yet it is
  1202.  difficult to debug programs with multiple statements on a single line. For
  1203.  example, the following code is legal in Pascal:
  1204.  
  1205.       if i = max then begin k := k+1; i = 0 end;
  1206.  
  1207.  This code is actually made up of five separate source statements. When
  1208.  placed on the same line, the individual statements cannot be accessed during
  1209.  debugging. You could not, for example, stop program execution at k := k+1;.
  1210.  The same code would be easier to debug if it were written as the following:
  1211.  
  1212.       if i = max then
  1213.             begin
  1214.                k := k+1;
  1215.                i := 0
  1216.             end;
  1217.  
  1218.  Writing only one statement on a line makes code easier to read and
  1219.  corresponds with what is generally considered good programming practice.
  1220.  
  1221.  Compiling and Linking Pascal Programs
  1222.  
  1223.  Versions 4.0 and later of Microsoft Pascal support the CodeView options /Zi
  1224.  and /Zd when you use the PL driver program. (For a description of these
  1225.  options, see Section 1.3.2, "CodeView Compile Options.") The CodeView
  1226.  compile options are put on the command line when invoking the first pass of
  1227.  the Pascal compiler.
  1228.  
  1229.  The /CO option is necessary only when you link separately.
  1230.  
  1231.  Example
  1232.  
  1233.       PL /Zi /c TEST
  1234.       LINK /CO TEST;
  1235.  
  1236.  The example above compiles the source file TEST.PAS to produce an object
  1237.  file, TEST.OBJ, which contains the symbol and line-number information
  1238.  required by the CodeView debugger. Then the linker is invoked with the /CO
  1239.  option.
  1240.  
  1241.  The CodeView debugger supports mixed-language programming. For an example of
  1242.  how to link a Pascal module with modules from other languages, see Section
  1243.  1.3.8 below.
  1244.  
  1245.  
  1246.  1.3.8  Preparing Assembly Programs
  1247.  
  1248.  In order to use all the features of the CodeView debugger with assembly
  1249.  programs, you need to assemble with Microsoft Macro Assembler, Version 5.0
  1250.  or later. (Section 1.7 discusses how to use earlier versions of Microsoft
  1251.  Macro Assembler with the debugger.) No matter what version of the assembler
  1252.  you use, you will need to link with the Microsoft Overlay Linker, Version
  1253.  3.6 or later.
  1254.  
  1255.  Writing Assembler Source Code
  1256.  
  1257.  If you have Version 5.0 or later of the Microsoft Macro Assembler, you can
  1258.  use the simplified segment directives described in the Microsoft Macro
  1259.  Assembler Programmer's Guide. Use of these directives ensures that segments
  1260.  are declared in the correct way for use with the CodeView debugger. (These
  1261.  directives also aid mixed-language programming.) If you do not use these
  1262.  directives, make sure that the class name for the code segment ends with the
  1263.  letters CODE.
  1264.  
  1265.  ───────────────────────────────────────────────────────────────────────────
  1266.  NOTE
  1267.     The CodeView debugger correctly recognizes floating-point values only
  1268.     when they are in the IEEE (Institute of Electrical and Electronics
  1269.     Engineers, Inc.) format. You should use the IEEE format with any program
  1270.     that you are going to run with the CodeView debugger if that program uses
  1271.     floating-point variables. The IEEE format is the default for Version 5.0
  1272.     or later of the Microsoft Macro Assembler. You can always specify IEEE
  1273.     format by using the .8087 or .287 directive, or by assembling with the
  1274.     /R option.
  1275.  ───────────────────────────────────────────────────────────────────────────
  1276.  
  1277.  You will not be able to trace through macros while in source mode. Macros
  1278.  will be treated as single instructions unless you are in assembly or mixed
  1279.  mode, so you will not see comments or directives within macros. Therefore,
  1280.  you may want to debug code before putting it into a macro.
  1281.  
  1282.  The Microsoft Macro Assembler also supports include files, but you will not
  1283.  be able to debug code in an include file. You are better off reserving
  1284.  include files for macro and structure definitions.
  1285.  
  1286.  Because the assembler does not have its own expression evaluator, you will
  1287.  have to use either the C, FORTRAN, or BASIC expression evaluator. C is the
  1288.  default because it is the closest to assembly language. To make sure the
  1289.  expression evaluator recognizes your symbols and labels, you should observe
  1290.  the following guidelines when writing assembly modules:
  1291.  
  1292.    1. The assembler has no explicit way to declare real numbers. However, it
  1293.       will pass the correct symbolic information for reals and integers if
  1294.       you initialize each real number with a decimal point and each integer
  1295.       without a decimal point. (The default type is integer.) For example,
  1296.       the following statements correctly initialize REALSUM as a real number
  1297.       and COUNTER as an integer:
  1298.  
  1299.           REALSUM    DD    0.0
  1300.           COUNTER    DD    0
  1301.  
  1302.       You must initialize real number data in data definitions. If you use ?,
  1303.       the assembler will consider the variable an integer when it generates
  1304.       symbolic information. The CodeView debugger, in turn, will not properly
  1305.       evaluate the value of the variable.
  1306.  
  1307.    2. Avoid the use of special characters in symbol names. The C, FORTRAN,
  1308.       and BASIC expression evaluators each apply their own standards in
  1309.       detemining what is a legal symbol name. Generally, only alphanumeric
  1310.       characters and the underscore (_) are recognized. BASIC accepts certain
  1311.       type-declaration characters at the end of a name, but C and FORTRAN do
  1312.       not.
  1313.  
  1314.    3. Assemble with /MX or /ML to avoid conflicts due to case when you do
  1315.       mixed-language programming. By default, the assembler converts all
  1316.       symbols to uppercase when it generates object code. C, however, does
  1317.       not do this conversion. Therefore, the CodeView debugger will not
  1318.       recognize that var in a C program and var in an assembly program are
  1319.       the same variable unless you leave Case Sense off when using the
  1320.       debugger.
  1321.  
  1322.    4. If you access command-line data in the Program Segment Prefix (PSP),
  1323.       note that the CodeView debugger changes the PSP; tabs, quote marks, and
  1324.       extra spaces are removed so that exactly one space separates each
  1325.       argument. The debugger retains quote marks (along with any quoted
  1326.       material) for command lines given with the L command.
  1327.  
  1328.  Assembling and Linking
  1329.  
  1330.  The assembler supports the /Zi and /Zd assemble-time options. The /Od option
  1331.  does not apply, and so is not supported. Assembler options are not case
  1332.  sensitive. You may therefore enter /ZI or /ZD on the assembler command line
  1333.  to produce an object file in the CodeView format.
  1334.  
  1335.  If you link your assembly program with a module written in C (which is case
  1336.  sensitive), you probably need to assemble with /MX or /ML.
  1337.  
  1338.  After assembling, link with the /CO option to produce an executable file in
  1339.  the CodeView format.
  1340.  
  1341.  Examples
  1342.  
  1343.       MASM /ZI EXAMPLE;
  1344.       LINK /CO EXAMPLE;
  1345.  
  1346.       MASM /ZI MOD1;
  1347.       MASM /ZD MOD2;
  1348.       LINK /CO MOD1 MOD2;
  1349.  
  1350.       CL /Zi /Od /c /AL prog.c
  1351.       BC /Zi sub1;
  1352.       MASM /ZI /MX sub2;
  1353.       LINK /CO prog sub1 sub2
  1354.  
  1355.  The first example assembles the source file EXAMPLE.ASM and produces the
  1356.  object file EXAMPLE.OBJ, which is in the CodeView format. The linker is then
  1357.  invoked with the /CO option and produces an executable file with the symbol
  1358.  table and line-number information required by the debugger.
  1359.  
  1360.  The second example produces the object file MOD1.OBJ, which contains symbol
  1361.  and line-number information, and the object file MOD2.OBJ, which contains
  1362.  line-number information but no symbol table. The object files are then
  1363.  linked. The result is an executable file in which the second module will be
  1364.  harder to debug. This executable file, however, will be smaller than it
  1365.  would be if both modules were assembled with the /ZI option.
  1366.  
  1367.  The last example demonstrates how to create a mixed-language executable file
  1368.  that can be used with the CodeView debugger. The debugger is able to trace
  1369.  through different source files in the same session, regardless of the
  1370.  language.
  1371.  
  1372.  
  1373.  1.4  Starting the CodeView Debugger
  1374.  
  1375.  Before starting the debugger, make sure all the files it requires are
  1376.  available. The following files are recommended for source-level debugging:
  1377.  
  1378.  File                        Location
  1379.  
  1380.  CV.EXE                      The CodeView program file can be in the current
  1381.                              directory or in any directory accessible with
  1382.                              the PATH command. For example, if you are using
  1383.                              a hard disk setup, you might put CV.EXE in the
  1384.                              \BIN directory. If you have an older version of
  1385.                              the debugger, take care to remove any copies of
  1386.                              CV.EXE from directories in your PATH. The
  1387.                              debugger has an overlay manager that reloads the
  1388.                              file CV.EXE from time to time. If it reloads the
  1389.                              wrong version of this file, your machine will
  1390.                              likely crash.
  1391.  
  1392.  CV.HLP                      If you want to have the on-line help available
  1393.                              during your session, you should have this file
  1394.                              either in the current directory or in any
  1395.                              directory accessible with the PATH command. For
  1396.                              example, if you set up your compiler files on a
  1397.                              hard disk using the SETUP program provided on
  1398.                              the distribution disk, you might put CV.HLP in
  1399.                              the \BIN directory. If the CodeView debugger
  1400.                              cannot find the help file, you can still use the
  1401.                              debugger, but you will see an error message if
  1402.                              you use one of the help commands.
  1403.  
  1404.  program.EXE                 The executable file for the program you wish to
  1405.                              debug must be in the current directory or in a
  1406.                              drive and directory you specify as part of the
  1407.                              start-up file specification. The CodeView
  1408.                              debugger will display an error message and will
  1409.                              not start unless the executable file is found.
  1410.  
  1411.  source.ext (extension       Normally, source files should be in the current
  1412.  depends on language)        directory. However, if you specify a file
  1413.                              specification for the source file during
  1414.                              compilation, that specification becomes part of
  1415.                              the symbolic information stored in the
  1416.                              executable file. For example, if you compiled
  1417.                              with the command line argument DEMO, the
  1418.                              CodeView debugger expects the source file to be
  1419.                              in the current directory. However, if you
  1420.                              compiled with the command line argument
  1421.                              \SOURCE\DEMO, the debugger expects the source
  1422.                              file to be in the directory \SOURCE. If the
  1423.                              debugger cannot find the source file in the
  1424.                              directory specified in the executable file
  1425.                              (usually the current directory), the program
  1426.                              prompts you for a new directory. You can either
  1427.                              enter a new directory, or you can press ENTER
  1428.                              to indicate that you do not want a source file
  1429.                              to be used for this module. If no source file is
  1430.                              specified, you must debug in assembly mode.
  1431.  
  1432.  If the appropriate files are in the correct directories, you can enter the
  1433.  CodeView command line at the DOS command prompt. The command line has the
  1434.  following form:
  1435.  
  1436.       CV «options» executablefile «arguments»
  1437.  
  1438.  The options are one or more of the options described in Section 1.5. The
  1439.  executablefile is the name of an executable file to be loaded by the
  1440.  debugger. It must have the extension .EXE or .COM. If you try to load a
  1441.  nonexecutable file, the following message appears:
  1442.  
  1443.       Not an executable file
  1444.  
  1445.  Compiled programs and assembly-language programs containing CodeView
  1446.  symbolic information will always have the extension .EXE. Files with the
  1447.  extension .COM can be debugged in assembly mode, but they can never contain
  1448.  symbolic information.
  1449.  
  1450.  The optional arguments are parameters passed to the executablefile. If the
  1451.  program you are debugging does not accept command-line arguments, you do not
  1452.  need to pass any arguments.
  1453.  
  1454.  If you specify the executablefile as a file name with no extension, the
  1455.  CodeView debugger searches for a file with the given base name and the
  1456.  extension .EXE. Therefore, you must specify the .COM extension if you are
  1457.  debugging a .COM file. If the file is not in the CodeView format, the
  1458.  debugger starts in assembly mode and displays the following message:
  1459.  
  1460.       No symbolic information
  1461.  
  1462.  You must specify an executable file when you start the CodeView debugger. If
  1463.  you omit the executable file, the debugger displays a message showing the
  1464.  correct command-line format.
  1465.  
  1466.  When you give the debugger a valid command line, the executable program and
  1467.  the source file are loaded, the address data are processed, and the CodeView
  1468.  display appears. The initial display will be in window mode or sequential
  1469.  mode, depending on the options you specify and the type of computer you
  1470.  have.
  1471.  
  1472.  For example, if you wanted to debug the program BENCHMRK.EXE, you could
  1473.  start the debugger with the following command line:
  1474.  
  1475.       CV BENCHMRK
  1476.  
  1477.  If you give this command line on an IBM Personal Computer, window mode is
  1478.  selected automatically. The display will look like Figure 1.1.
  1479.  
  1480.  If you give the same command line on most non-IBM computers, sequential mode
  1481.  will be selected. The following lines appear:
  1482.  
  1483.       Microsoft (R) CodeView (R)  Version 2.3
  1484.       (C) Copyright Microsoft Corp. 1986-1989. All rights reserved.
  1485.  
  1486.       >
  1487.  
  1488.  You can use CodeView options to override the default start-up mode.
  1489.  
  1490.  If your program is written in a high-level language, the CodeView debugger
  1491.  is now at the beginning of the start-up code that precedes your program. In
  1492.  source mode, you can enter an execution command (such as Trace or Program
  1493.  Step) to execute automatically through the start-up code to the beginning of
  1494.  your program. At this point, you are ready to start debugging your program,
  1495.  as described in Chapters 3-11.
  1496.  
  1497.  
  1498.  1.5  Using CodeView Options
  1499.  
  1500.  You can change the start-up behavior of the debugger by specifying options
  1501.  in the command line. An option is a sequence of characters preceded by
  1502.  either a forward slash (/) or a dash (-).
  1503.  
  1504.  For brevity, this manual will list only the forward slash when describing
  1505.  options, but you may use either. Unlike compiler command-line options,
  1506.  CodeView command-line options are not case sensitive.
  1507.  
  1508.  A file whose name begins with a dash must be renamed before you use it with
  1509.  the CodeView debugger so the debugger will not interpret the dash as an
  1510.  option designator. You can use more than one option in a command line, but
  1511.  each option must have its own option designator, and spaces must separate
  1512.  each option from other elements of the line.
  1513.  
  1514.  ───────────────────────────────────────────────────────────────────────────
  1515.  NOTE
  1516.     The CodeView debugger's defaults for IBM Personal Computers are different
  1517.     from the defaults it has for other computers. However, the debugger may
  1518.     not always recognize the difference between computers, and defaults may
  1519.     vary accordingly.
  1520.  ───────────────────────────────────────────────────────────────────────────
  1521.  
  1522.  The following list suggests some situations in which you might want to use
  1523.  an option. If more than one condition applies, you can use more than one
  1524.  option (in any order). If none of the conditions applies, you need not use
  1525.  any options.
  1526.  
  1527.  Condition                                               Option
  1528.  
  1529.  You want to use two monitors with the                   /2
  1530.  CodeView debugger.
  1531.  
  1532.  You want a 43-line display and you have an              /43
  1533.  IBM or IBM-compatible computer with an
  1534.  enhanced graphics adapter (EGA) and an
  1535.  enhanced color display.
  1536.  
  1537.  You want a 50-line display and you have a               /50
  1538.  graphics adapter card that supports 50-line
  1539.  mode.
  1540.  
  1541.  You have a two-color monitor, a color                   /B
  1542.  graphics adapter, and an IBM or
  1543.  IBM-compatible computer.
  1544.  
  1545.  You want the CodeView debugger to                       /Ccommands
  1546.  automatically execute a series of commands when
  1547.  it starts up.
  1548.  
  1549.  You are using an IBM-compatible computer                /D
  1550.  that does not support certain IBM-specific
  1551.  interrupt-trapping functions.
  1552.  
  1553.  You have expanded memory and want the                   /E
  1554.  CodeView debugger to take advantage of it.
  1555.  
  1556.  You are using an IBM-compatible computer                /F
  1557.  to debug a program that does not use graphics
  1558.  or multiple video-display pages,
  1559.  and you want to be able to see the output
  1560.  screen.
  1561.  
  1562.  You are using a non-IBM-compatible                      /I
  1563.  computer and want to enable CTRL+C and
  1564.  CTRL+BREAK.
  1565.  
  1566.  You run CodeView (CVP) in OS/2 protected mode           /L
  1567.  and want to debug dynamic-link libraries.
  1568.  
  1569.  You have a mouse installed in your                      /M
  1570.  system, but do not want to use it during the
  1571.  debugging session.
  1572.  
  1573.  You run CodeView (CVP) with OS/2, Version 1.10          /O
  1574.  or later, and wish to debug multiple processes.
  1575.  
  1576.  You have a non-IBM EGA and have problems                /P
  1577.  running the debugger.
  1578.  
  1579.  You have a 386 processor and wish to                    /R
  1580.  use the debug registers to speed up the
  1581.  execution of tracepoints.
  1582.  
  1583.  You are debugging a graphics program or a               /S
  1584.  program that uses multiple video-display
  1585.  pages, and you want to be able to see the
  1586.  output screen.
  1587.  
  1588.  You are using a non-IBM-compatible                      /S
  1589.  computer and want to be able to see the output
  1590.  screen.
  1591.  
  1592.  You have an IBM computer, but wish to                   /T
  1593.  debug in sequential mode (for example, with
  1594.  redirection).
  1595.  
  1596.  You have an IBM-compatible computer                     /W
  1597.  and want to use window mode.
  1598.  
  1599.  For example, assume you are using an IBM-compatible computer with a color
  1600.  graphics adapter (CGA) and a two-color monitor. The program you are
  1601.  debugging, which you could name GRAPHIX.EXE, plots points in graphics mode.
  1602.  You want to be able to see the output screen during the debugging session.
  1603.  Finally, you want to be able to start the debugger several times without
  1604.  having to remember all the options, and you want to execute the high-level
  1605.  language start-up code automatically each time. You could create a batch
  1606.  file consisting of the following line:
  1607.  
  1608.       CV /W /B /S /CGmain GRAPHIX
  1609.  
  1610.  The CodeView options are described in more detail in Sections 1.5.1-1.5.16
  1611.  below.
  1612.  
  1613.  
  1614.  1.5.1  Using Two Video Adapters
  1615.  
  1616.  Option
  1617.  
  1618.       /2
  1619.  
  1620.  The /2 option permits the use of two monitors with the CodeView debugger.
  1621.  The program display will appear on the current default monitor, while the
  1622.  CodeView display appears on the other monitor. You must have two monitors
  1623.  and two adapters to use the /2 option. For instance, if you have both a
  1624.  color graphics adapter and a monochrome adapter, you might want to set the
  1625.  CGA up as the default adapter. You could then debug a graphics program with
  1626.  the graphics display appearing on the graphics monitor and the debugging
  1627.  display appearing on the monochrome monitor.
  1628.  
  1629.  
  1630.  1.5.2  Using the Enhanced Graphics Adapter's 43-Line Mode
  1631.  
  1632.  Option
  1633.  
  1634.       /43
  1635.  
  1636.  If you have an enhanced graphics adapter (EGA) and a monochrome monitor or
  1637.  an enhanced color display monitor (or a compatible monitor), you can use the
  1638.  /43 option to enable a 43-line-by-80-column text mode. You cannot use this
  1639.  mode with other monitors, such as a CGA or a monochrome adapter (MA). The
  1640.  CodeView debugger will ignore the option if it does not detect an EGA.
  1641.  
  1642.  The EGA's 43-line mode performs the same as the normal 25-line-by-80-column
  1643.  mode used by default on the EGA, CGA, and MA. The advantage of the 43-line
  1644.  mode is that more text fits on the CodeView display; the disadvantage is
  1645.  that the text is smaller and harder to read. If you have an EGA, you can
  1646.  experiment to see which size you prefer.
  1647.  
  1648.  The video graphics adapter (VGA) card also supports this option.
  1649.  
  1650.  Example
  1651.  
  1652.       CV /43 CALC CALC.DAT
  1653.  
  1654.  The example above starts the CodeView debugger in 43-line mode if you have
  1655.  an EGA video adapter and an enhanced color or monochrome monitor. The option
  1656.  will be ignored if you lack the hardware to support it.
  1657.  
  1658.  
  1659.  1.5.3  Using 50-Line Mode
  1660.  
  1661.  Option
  1662.  
  1663.       /50
  1664.  
  1665.  If you have a graphics adapter card (such as a VGA) and monitor that support
  1666.  50-line mode, then you can use the /50 option to enable a
  1667.  50-line-by-80-column text mode. You cannot use this mode with most adapters,
  1668.  such as a CGA or an MA. The CodeView debugger will ignore the option if your
  1669.  hardware does not support 50-line mode.
  1670.  
  1671.  The 50-line mode performs the same as the normal 25-line-by-80-column mode
  1672.  used by default on the EGA, VGA, CGA, and MA. The advantage of the 50-line
  1673.  mode is that more text fits on the CodeView display; the disadvantage is
  1674.  that the text is smaller and harder to read.
  1675.  
  1676.  Example
  1677.  
  1678.       CV /50 CALC CALC.DAT
  1679.  
  1680.  The example above starts the CodeView debugger in 50-line mode if this mode
  1681.  is supported by your hardware.
  1682.  
  1683.  
  1684.  1.5.4  Starting with a Black-and-White Display
  1685.  
  1686.  Option
  1687.  
  1688.       /B
  1689.  
  1690.  The /B option forces the CodeView debugger to display in two colors even if
  1691.  you have a color adapter (CGA, EGA, or compatible). By default, the debugger
  1692.  checks on start-up to see what kind of display adapter is attached to your
  1693.  computer. If the debugger detects an MA, it displays in two colors. If it
  1694.  detects a color adapter, it displays in multiple colors.
  1695.  
  1696.  If you use a two-color monitor with a CGA or EGA, you may want to disable
  1697.  color. Monitors that display in only two colors (usually green and black, or
  1698.  amber and black) often attempt to show colors with different cross-hatching
  1699.  patterns, or in gray-scale shades of the display color. In either case, you
  1700.  may find the display easier to read if you use the /B option to force
  1701.  black-and-white display. Most two-color monitors still have four color
  1702.  distinctions: background (black), normal text, high-intensity text, and
  1703.  reverse-video text.
  1704.  
  1705.  Example
  1706.  
  1707.       CV /B CALC CALC.DAT
  1708.  
  1709.  The example above starts the CodeView debugger in black-and-white mode. This
  1710.  is the only mode available if you have an MA. The display is usually easier
  1711.  to read in this mode if you have a CGA and a two-color monitor.
  1712.  
  1713.  
  1714.  1.5.5  Specifying Start-Up Commands
  1715.  
  1716.  Option
  1717.  
  1718.       /Ccommands
  1719.  
  1720.  The /C option allows you to specify one or more commands that will be
  1721.  executed automatically upon start-up. You can use these options to invoke
  1722.  the debugger from a batch or MAKE file. Each command is separated from the
  1723.  previous command by a semicolon.
  1724.  
  1725.  If one or more of your start-up commands have arguments that require spaces
  1726.  between them, you should enclose the entire option in double quotation
  1727.  marks. Otherwise, the debugger will interpret each argument as a separate
  1728.  CodeView command-line argument rather than as a debugging-command argument.
  1729.  
  1730.  ───────────────────────────────────────────────────────────────────────────
  1731.  WARNING
  1732.     Any start-up option that uses the less-than (<) or greater-than (>)
  1733.     symbol must be enclosed in double quotation marks even if it does not
  1734.     require spaces. This ensures that the redirection command will be
  1735.     interpreted by the CodeView debugger rather than by DOS.
  1736.  ───────────────────────────────────────────────────────────────────────────
  1737.  
  1738.  Examples
  1739.  
  1740.       CV /CGmain CALC CALC.DAT
  1741.  
  1742.  The example above loads the CodeView debugger with CALC as the executable
  1743.  file and CALC.DAT as the argument. Upon start-up, the debugger executes the
  1744.  high-level-language start-up code with the command Gmain. Since no space is
  1745.  required between the CodeView command (G) and its argument (main), the
  1746.  option is not enclosed in double quotation marks.
  1747.  
  1748.       CV "/C;S&;G INTEGRAL;DS ARRAYX L 20" CALC CALC.DAT
  1749.  
  1750.  The example above loads the same file with the same argument as the first
  1751.  example, but the command list is more extensive. The debugger starts in
  1752.  mixed source/assembly mode ( S&). It executes to the routine INTEGRAL(G
  1753.  INTEGRAL), and then dumps 20 short real numbers, starting at the address of
  1754.  the variable ARRAYX (DS ARRAYXL 20). Since several of the commands use
  1755.  spaces, the entire option is enclosed in double quotation marks.
  1756.  
  1757.       CV "/C<INPUT.FIL" CALC CALC.DAT
  1758.  
  1759.  The example above loads the same file and argument as the first example, but
  1760.  the start-up command directs the debugger to accept the input from the file
  1761.  INPUT.FIL rather than from the keyboard. Although the option does not
  1762.  include any spaces, it must be enclosed in double quotation marks so that
  1763.  the less-than symbol will be read by the CodeView debugger rather than by
  1764.  DOS.
  1765.  
  1766.  
  1767.  1.5.6  Handling Interrupt Trapping (DOS Only)
  1768.  
  1769.  Options
  1770.  
  1771.       /D
  1772.  
  1773.  The /D option turns off nonmaskable interrupt (NMI) trapping and 8259
  1774.  interrupt trapping. If you are using an IBM PC Convertible, Tandy(R) 1000,
  1775.  or the AT&T(R) 6300 Plus and you are experiencing system crashes with
  1776.  CodeView, try starting with the /D option. To enable window mode, use /W
  1777.  with /D; otherwise sequential mode is set automatically. Note that because
  1778.  this option turns off interrupt trapping, CTRL+C and CTRL+BREAK will not
  1779.  work, and an external interrupt may occur during a trace operation. If this
  1780.  happens, you may find yourself tracing the interrupt handler instead of your
  1781.  program.
  1782.  
  1783.  The /I option forces the debugger to handle NMI and 8259 interrupt trapping.
  1784.  Use this option to enable CTRL+C and CTRL+BREAK on computers not recognized
  1785.  as being IBM compatible by the debugger, such as the Eagle(R) PC. Window
  1786.  mode is set automatically with the /I option; you don't have to specify /W.
  1787.  Using the /I option lets you stop program execution at any point while you
  1788.  are using the CodeView debugger.
  1789.  
  1790.  
  1791.  1.5.7  Using Expanded Memory (DOS Only)
  1792.  
  1793.  Option
  1794.  
  1795.       /E
  1796.  
  1797.  "Expanded memory" refers to memory made accessible according to the
  1798.  Microsoft/Lotus(R)/Intel(R) EMS specification. This access provides your
  1799.  system with memory above the 640K MS-DOS limitation on RAM. However, since
  1800.  MS-DOS will not recognize this additional memory, programs can make use of
  1801.  expanded memory in limited ways.
  1802.  
  1803.  The /E option enables the use of expanded memory. If expanded memory is
  1804.  present, the CodeView debugger uses it to store the symbolic information of
  1805.  the program. This may be as much as 85% of the size of the executable file
  1806.  for the program, and represents space that would otherwise be taken up in
  1807.  main memory.
  1808.  
  1809.  ───────────────────────────────────────────────────────────────────────────
  1810.  NOTE
  1811.     This option enables only expanded memory, not extended memory. Extended
  1812.     memory makes use of protected-mode instructions,rather than the
  1813.     Microsoft/Lotus/Intel specification for memory paging.
  1814.  ───────────────────────────────────────────────────────────────────────────
  1815.  
  1816.  
  1817.  1.5.8  Setting the Screen-Exchange Mode (DOS Only)
  1818.  
  1819.  Options
  1820.  
  1821.       /F
  1822.       /S
  1823.  
  1824.  The CodeView debugger allows you to move quickly back and forth between the
  1825.  output screen, which contains the output from your program, and the
  1826.  debugging screen, which contains the debugging display. The debugger can
  1827.  handle this screen exchange in two ways: screen flipping or screen swapping.
  1828.  The /F option (screen flipping) and the /S option (screen swapping) allow
  1829.  you to choose the method from the command line. If neither method is
  1830.  specified (possible only on non-IBM computers), the Screen Exchange command
  1831.  will not work. No screen exchange is the default for non-IBM computers.
  1832.  Screen flipping is the default for IBM computers with graphics adapters, and
  1833.  screen swapping is the default for IBM computers with monochrome adapters.
  1834.  Screen flipping uses the video-display pages of the graphics adapter to
  1835.  store each screen of text. Video-display pages are a special memory buffer
  1836.  reserved for multiple screens of video output. This method is faster and
  1837.  uses less memory than screen swapping. However, screen flipping cannot be
  1838.  used with an MA, nor to debug programs that produce graphics or use the
  1839.  video-display pages. In addition, the CodeView debugger's screen flipping
  1840.  works only with IBM and IBM-compatible microcomputers.
  1841.  
  1842.  Screen swapping has none of the limitations of screen flipping, but is
  1843.  significantly slower and requires more memory. In the screen-swapping
  1844.  method, the CodeView debugger creates a buffer in memory and uses it to
  1845.  store the screen that is not being used. When the user requests the other
  1846.  screen, the debugger swaps the screen in the display buffer for the one in
  1847.  the storage buffer.
  1848.  
  1849.  When you use screen swapping, the buffer size is 16K for all adapters. The
  1850.  amount of memory used by the CodeView debugger is increased by the size of
  1851.  the buffer.
  1852.  
  1853.  Table 1.1 shows the default exchange mode (swapping or flipping) and the
  1854.  default display mode (sequential or window) for various configurations.
  1855.  Display modes are discussed in Section 1.5.14, "Enabling Window or
  1856.  Sequential Mode."
  1857.  
  1858.  Table 1.1  Default Exchange and Display Modes
  1859. ╓┌────────────────────┌───────────────┌───────────┌──────────────────────────
  1860.  
  1861.                       Display         Default
  1862.  Computer             Adapter         Modes       Alternate Modes
  1863.  
  1864.  IBM                  CGA or EGA      /F /W       /S if your program uses vide
  1865.                                                   display pages or graphics; /
  1866.                                                   mode
  1867.  
  1868.  IBM compatible       CGA or EGA      /T          /W for window mode; /F for s
  1869.                                                   with text programs; or /S fo
  1870.                                                   with programs that use video
  1871.  
  1872.                       Display         Default
  1873.  Computer             Adapter         Modes       Alternate Modes
  1874.                                                  with programs that use video
  1875.                                                   graphics
  1876.  
  1877.  IBM                  MA              /S /W       /T for sequential mode
  1878.  
  1879.  IBM compatible       MA              /T          /W for window mode; /S for s
  1880.  
  1881.  Noncompatible        Any             /T          /S for screen swapping
  1882.  
  1883.  
  1884.  If you are not sure if your computer is completely IBM compatible, you can
  1885.  experiment. If the basic input/output system (BIOS) of your computer is not
  1886.  compatible enough, the CodeView debugger may not work with the /F option.
  1887.  
  1888.  If you specify the /F option with an MA, the debugger ignores the option
  1889.  and uses screen swapping. If you try to use screen flipping to debug a
  1890.  program that produces graphics or uses the video-display pages, you may get
  1891.  unexpected results and have to start over with the /S option.
  1892.  
  1893.  Examples
  1894.  
  1895.       CV /F CALC CALC.DAT
  1896.  
  1897.  The example above starts the CodeView debugger with screen flipping. You
  1898.  might use this command line if you have an IBM-compatible computer, and you
  1899.  want to override the default screen-exchange mode in order to use less
  1900.  memory and switch screens more quickly. The option would not be necessary on
  1901.  an IBM computer, since screen flipping is the default.
  1902.  
  1903.       CV /S GRAFIX
  1904.  
  1905.  The example above starts the debugger with screen swapping. You might use
  1906.  this command line if your program uses graphics mode.
  1907.  
  1908.  
  1909.  1.5.9  Loading Information from Dynamic-Link Libraries (OS/2 Only)
  1910.  
  1911.  Option
  1912.  
  1913.       /L dynlib
  1914.  
  1915.  The /L option directs the protected-mode CodeView debugger (CVP) to search
  1916.  dynlib for symbolic information. At least one space must separate /L from
  1917.  dynlib.
  1918.  
  1919.  CVP can debug dynamic-link libraries, but only if it is told what libraries
  1920.  to search at run time. When you place a module in a dynamic-link library,
  1921.  neither code nor symbolic information for that module is stored in an
  1922.  application's executable (.EXE) file. Instead, the code and symbols are
  1923.  stored in the library and are not brought together with the main program
  1924.  until run time.
  1925.  
  1926.  Thus, the protected-mode debugger needs to search the dynamic-link library
  1927.  for symbolic information. Because the debugger does not automatically know
  1928.  which libraries to look for, use /L to load symbolic information for
  1929.  dynamic-link libraries. You should use this option only with libraries that
  1930.  you have created and wish to debug.
  1931.  
  1932.  Example
  1933.  
  1934.       CVP /L DLIB1.DLL /L GRAFLIB.DLL PROG
  1935.  
  1936.  In the example above, CVP is invoked to debug the program PROG.EXE. To find
  1937.  symbolic information needed for debugging each module, CVP searches
  1938.  libraries DLIB1.DLL and DLIB2.DLL, as well as the executable file PROG.EXE.
  1939.  
  1940.  
  1941.  1.5.10  Turning Off the Mouse
  1942.  
  1943.  Option
  1944.  
  1945.       /M
  1946.  
  1947.  If you have a mouse installed on your system, you can tell the CodeView
  1948.  debugger to ignore it by using the /M option. You may need to use this
  1949.  option if you are debugging a program that uses the mouse and your mouse is
  1950.  not a Microsoft Mouse. This is due to a conflict between the program's use
  1951.  of the mouse and the debugger's use of it. Use of /M may possibly disable
  1952.  the program's use of the mouse, as well as CodeView's.
  1953.  
  1954.  ───────────────────────────────────────────────────────────────────────────
  1955.  NOTE
  1956.     The same conflict between program and debugger applies if you are not
  1957.     using the current Microsoft Mouse driver program (MOUSE.SYS), which is
  1958.     included on the distribution disks for certain Microsoft products. You
  1959.     may want to replace your old mouse driver program with the updated
  1960.     version. You will then be able to use the mouse with both the CodeView
  1961.     debugger and the program you are debugging. If you did not install a
  1962.     mouse driver when you set up Version 4.0 of Microsoft FORTRAN, Version
  1963.     5.0 or later of Microsoft C, or Version 5.0 or later of Macro Assembler,
  1964.     see your user's guide for information on installing MOUSE.SYS. These
  1965.     programs may not work with pointing devices from other manufacturers.
  1966.  ───────────────────────────────────────────────────────────────────────────
  1967.  
  1968.  
  1969.  1.5.11  Debugging Multiple Processes (OS/2 only)
  1970.  
  1971.  Option
  1972.  
  1973.       /O
  1974.  
  1975.  If you are running OS/2, version 1.10 or later, you can use the /O option to
  1976.  enable debugging of multiple processes. See Chapter 12, "Debugging in
  1977.  Protected Mode," for more information on how to debug multiple processes.
  1978.  
  1979.  ───────────────────────────────────────────────────────────────────────────
  1980.  NOTE
  1981.     The /O option is incompatible with the /2 option.
  1982.  ───────────────────────────────────────────────────────────────────────────
  1983.  
  1984.  
  1985.  1.5.12  Extending EGA Compatibility
  1986.  
  1987.  Option
  1988.  
  1989.       /P
  1990.  
  1991.  The use of the /P option may enable the CodeView debugger to run properly in
  1992.  window mode on a non-IBM version of the enhanced graphics adapter (EGA).
  1993.  
  1994.  Normally, the debugger saves and restores the palette registers of an EGA.
  1995.  However, although this procedure works perfectly well with an IBM EGA, it
  1996.  can create conflicts with other EGAs. The /P option prevents the saving and
  1997.  restoring of palette registers, and so may enhance compatibility.
  1998.  
  1999.  Symptoms that may indicate the need for using /P include the debugging
  2000.  screen starting in nonstandard colors and the debugger appearing to crash
  2001.  while in window mode.
  2002.  
  2003.  ───────────────────────────────────────────────────────────────────────────
  2004.  NOTE
  2005.     The /P option may cause the program being debugged to lose some colors
  2006.     whenever you switch back and forth between the debugging screen and the
  2007.     output screen. Therefore, do not use the /P option unless necessary.
  2008.  ───────────────────────────────────────────────────────────────────────────
  2009.  
  2010.  
  2011.  1.5.13  Using Debug Registers (386 Only)
  2012.  
  2013.  Option
  2014.  
  2015.       /R
  2016.  
  2017.  If you have a 386 processor, you can enable the four debug registers by
  2018.  giving the /R option. The debug registers can hold up to four tracepoints.
  2019.  Normally,   tracepoints slow down execution of the program substantially
  2020.  since CodeView must interrupt the program after each instruction and test
  2021.  all tracepoints and watchpoints. Use of debug registers lets CodeView
  2022.  implement tracepoints through the processor itself. CodeView can therefore
  2023.  execute the program at normal speed even though areas of memory are being
  2024.  monitored.
  2025.  
  2026.  If you specify more than four watchpoints or specify any watch expression,
  2027.  CodeView does not use the debug registers.
  2028.  
  2029.  
  2030.  1.5.14  Enabling Window or Sequential Mode
  2031.  
  2032.  Options
  2033.  
  2034.       /T
  2035.  
  2036.  The CodeView debugger can operate in window mode or sequential mode. Window
  2037.  mode displays up to four windows, enabling you to see different aspects of
  2038.  the debugging-session program simultaneously. You can also use a mouse in
  2039.  window mode. Window mode requires an IBM or IBM-compatible microcomputer.
  2040.  Sequential mode works with any computer and is useful with redirection
  2041.  commands. Debugging information is displayed sequentially on the screen.
  2042.  
  2043.  The behavior of each mode is discussed in detail in Chapter 2, "The
  2044.  CodeView Display." Refer back to Table 1.1 for the default and alternate
  2045.  modes for your computer. If you are not sure if your computer is completely
  2046.  IBM compatible, you can experiment with the options. If the BIOS of your
  2047.  computer is not compatible enough, you may not be able to use window mode
  2048.  (the /W option).
  2049.  
  2050.  ───────────────────────────────────────────────────────────────────────────
  2051.  NOTE
  2052.     Although window mode is more convenient, any debugging operation that can
  2053.     be done in window mode can also be done in sequential mode.
  2054.  ───────────────────────────────────────────────────────────────────────────
  2055.  
  2056.  Examples
  2057.  
  2058.       CV /W SIEVE
  2059.  
  2060.  The example above starts the CodeView debugger in window mode. You will
  2061.  probably want to use the /W option if you have an IBM-compatible computer
  2062.  since the default sequential mode is less convenient for most debugging
  2063.  tasks.
  2064.  
  2065.       CV /T SIEVE
  2066.  
  2067.  The example above starts the debugger in sequential mode. You might want to
  2068.  use this option if you have an IBM computer and have a specific reason for
  2069.  using sequential mode. For instance, sequential mode usually works better if
  2070.  you are redirecting your debugging output to a remote terminal.
  2071.  
  2072.  
  2073.  1.6  Debugging Large Programs
  2074.  
  2075.  Because the CodeView debugger must reside in memory along with the program
  2076.  you are debugging, there may not be enough room to debug some large programs
  2077.  that could otherwise run in memory alone. However, there are at least three
  2078.  ways to get around memory limitations:
  2079.  
  2080.    1. If you have expanded memory, use the /E option described earlier. This
  2081.       will enable CodeView to put the symbol table in expanded memory, thus
  2082.       freeing up a good deal of main memory.
  2083.  
  2084.    2. Since CodeView now supports the debugging of overlaid programs, you can
  2085.       substantially reduce the amount of memory required to run your program
  2086.       by using overlays when you link your program.
  2087.  
  2088.    3. Save space by using /Zi with modules you plan to focus on in the
  2089.       debugging session only, using /Zd with other modules.
  2090.  
  2091.  
  2092.  1.7  Working with Older Versions of the Assembler
  2093.  
  2094.  You can run the CodeView debugger with files developed using older versions
  2095.  of the Microsoft or IBM assemblers (prior to 5.0). Since older versions do
  2096.  not write line numbers to object files, some of the CodeView debugger's
  2097.  features will not be available when you debug programs developed with the
  2098.  older assemblers. The following considerations apply in addition to the
  2099.  considerations mentioned in Section 1.3.8, "Preparing Assembly Programs."
  2100.  
  2101.  The procedure for assembling and debugging .EXE files by using older
  2102.  versions of the assembler is summarized below. The debugger can be used on
  2103.  either .EXE or .COM files, but you can only view symbolic information in
  2104.  .EXE files.
  2105.  
  2106.    1. In your source file, declare public any symbols, such as labels and
  2107.       variables, that you want to reference in the debugger. If the file is
  2108.       small, you may want to declare all symbols public.
  2109.  
  2110.    2. As mentioned earlier, make sure that the code segment class name ends
  2111.       with the letters CODE. (For example: 'MYCODE.)
  2112.  
  2113.    3. Assemble as usual. No special options are required, and all assembly
  2114.       options are allowed.
  2115.  
  2116.    4. Use LINK, Version 3.6 or later. Do not use the linker provided with
  2117.       older assembler versions. Use the /CODEVIEW option when linking.
  2118.  
  2119.    5. Debug in assembly mode (this is the start-up default if the debugger
  2120.       fails to find line-number information). You cannot use source mode for
  2121.       debugging, but you can load the source file into the display window and
  2122.       view it in source mode. Any labels or variables that you declared
  2123.       public in the source file can be displayed and referenced by name
  2124.       instead of by address. However, they cannot be used in expressions
  2125.       because type information is not written to the object file.
  2126.  
  2127.  
  2128.  Chapter 2  The CodeView Display
  2129.  ───────────────────────────────────────────────────────────────────────────
  2130.  
  2131.  The Microsoft CodeView debugger screen display can appear in two different
  2132.  modes──window and sequential. Either mode provides a useful debugging
  2133.  environment, but window mode is more powerful and convenient. The CodeView
  2134.  debugger accepts either window commands or dialog commands. Dialog commands
  2135.  are entered as command lines following the CodeView prompt (>) in sequential
  2136.  mode. They are discussed in Chapter 3, "Using Dialog Commands."
  2137.  
  2138.  You will probably want to use window mode if you have the hardware to
  2139.  support it. In window mode, the pull-down menus, function keys, and mouse
  2140.  support offer fast access to the most common commands. Different aspects of
  2141.  the program and debugging environment can be seen in different windows
  2142.  simultaneously. Window mode is described in Section 2.1 below.
  2143.  
  2144.  Sequential mode is similar to the display mode of the CodeView debugger's
  2145.  forerunner, the Microsoft Symbolic Debug Utility (SYMDEB) and the DOS DEBUG
  2146.  utility. This mode is required if you do not have an IBM-compatible
  2147.  computer, and it is sometimes useful when redirecting command input or
  2148.  output. Sequential mode is described in Section 2.2.
  2149.  
  2150.  
  2151.  2.1  Using Window Mode
  2152.  
  2153.  The elements of the CodeView display marked in Figure 2.1 below include the
  2154.  following:
  2155.  
  2156.    1. The display window shows the program being debugged. It can contain
  2157.       source code (as in the example), assembly-language instructions, or any
  2158.       specified text file.
  2159.  
  2160.    2. The current location line (the next line the program will execute) is
  2161.       displayed in reverse video or in a different color. This line may not
  2162.       always be visible because you can scroll to earlier or later parts of
  2163.       the program.
  2164.  
  2165.    3. Lines containing previously set breakpoints are shown in high-intensity
  2166.       text.
  2167.  
  2168.    4. The dialog window is where you enter dialog commands. These are the
  2169.       commands with optional arguments that you can enter at the CodeView
  2170.       prompt (>). You can scroll up or down in this window to view previous
  2171.       dialog commands and command output.
  2172.  
  2173.    5. The cursor is a thin, blinking line that shows the location at which
  2174.       you can enter commands from the keyboard. You can move the cursor up
  2175.       and down, and place it in either the dialog or display window.
  2176.  
  2177.    6. The display/dialog separator line divides the dialog window from the
  2178.       display window.
  2179.  
  2180.    7. The register window shows the current status of processor registers and
  2181.       flags. It is an optional window that can be opened or closed with one
  2182.       keystroke or with the mouse. If the 386 option is on, a much wider
  2183.       register window is displayed, with 32-bit registers. The register
  2184.       window also displays the effective address at the bottom; the effective
  2185.       address shows the actual location of an operand in physical memory. It
  2186.       is useful when debugging in assembly mode.
  2187.  
  2188.    8. The scroll bars are the vertical bars on the right side of the screen.
  2189.       Each scroll bar has an up arrow and a down arrow you can use to scroll
  2190.       through the display with a mouse.
  2191.  
  2192.    9. The optional watch window shows the current status of specified
  2193.       variables or expressions. The watch window appears automatically
  2194.       whenever you create watch statements.
  2195.  
  2196.   10. The menu bar shows titles of menus and commands that you can activate
  2197.       with the keyboard or the mouse. "Trace" and "Go" represent commands;
  2198.       the other titles are all menus.
  2199.  
  2200.   11. Menus can be opened by specifying the appropriate title on the menu
  2201.       bar. On the sample screen, the Watch menu has been opened.
  2202.  
  2203.   12. The menu "highlight" is a reverse-video or colored strip indicating the
  2204.       current selection in a menu. You can move the highlight up or down to
  2205.       change the current selection.
  2206.  
  2207.   13. The mouse pointer indicates the current position of the mouse. It is
  2208.       shown only if you have a mouse installed on your system.
  2209.  
  2210.   14. Dialog boxes (not shown) appear in the center of the screen when you
  2211.       choose a menu selection that requires a response. The dialog box
  2212.       prompts you for a response and then it disappears when you enter your
  2213.       answer.
  2214.  
  2215.   15. Message boxes (not shown) appear in the center of the screen to display
  2216.       errors or other messages.
  2217.  
  2218.  The Microsoft CodeView debugger screen elements are described in greater
  2219.  detail in the rest of this chapter.
  2220.  
  2221.  
  2222.  2.1.1  Executing Window Commands with the Keyboard
  2223.  
  2224.  The most common CodeView debugging commands, and all the commands for
  2225.  managing the CodeView display, are available with window commands. Window
  2226.  commands are one-keystroke commands that can be entered with CTRL-key
  2227.  combinations, ALT-key combinations, or the direction keys on the numeric
  2228.  keypad.
  2229.  
  2230.  Most window commands can also be entered with a mouse, as described in
  2231.  Section 2.1.2.1, "Changing the Screen with the Mouse." The window commands
  2232.  available from the keyboard are described by category in Sections
  2233.  2.1.1.1-2.1.1.4 below.
  2234.  
  2235.  2.1.1.1  Moving the Cursor with Keyboard Commands
  2236.  
  2237.  The following keys move the cursor or scroll text up or down in the display
  2238.  or dialog window.
  2239.  
  2240. ╓┌───────────────────────────┌───────────────────────────────────────────────╖
  2241.  Key                         Function(Switch Cursor)
  2242.  
  2243.  F6                          Moves the cursor between the display and dialog
  2244.                              windows.
  2245.  
  2246.                              If the cursor is in the dialog window when you
  2247.                              press F6, it will move to its previous position
  2248.                              in the display window. If the cursor is in the
  2249.  Key                         Function(Switch Cursor)
  2250.  
  2251.                             in the display window. If the cursor is in the
  2252.                              display window, it will move to its previous
  2253.                              position in the dialog window.
  2254.  
  2255.  CTRL+G                      Makes the size of the dialog window or display
  2256.                              window grow.
  2257.  
  2258.                              This works for whichever window the cursor is
  2259.                              in. If the cursor is in the display window, the
  2260.                              display/dialog separator line will move down
  2261.                              one line. If the cursor is in the dialog window,
  2262.                              the separator line will move up one line.
  2263.  
  2264.  CTRL+T                      Makes the size of the dialog or display window
  2265.                              smaller.
  2266.  
  2267.                              This works for whichever window the cursor is
  2268.                              in. If the cursor is in the display window, the
  2269.                              display/dialog separator line will move up one
  2270.  Key                         Function(Switch Cursor)
  2271.  
  2272.                             display/dialog separator line will move up one
  2273.                              line. If the cursor is in the dialog window, the
  2274.                              separator line will move down one line.
  2275.  
  2276.  UP ARROW                    Moves the cursor up one line in either the
  2277.                              display or dialog window.
  2278.  
  2279.  DOWN ARROW                  Moves the cursor down one line in either the
  2280.                              display or dialog window.
  2281.  
  2282.  PGUP                        Scrolls up one page.
  2283.  
  2284.                              If the cursor is in the display window, the
  2285.                              source lines or assembly-language instructions
  2286.                              scroll up. If the cursor is in the dialog
  2287.                              window, the buffer of commands entered during
  2288.                              the session scrolls up. The cursor remains at
  2289.                              its current position in the window. The length
  2290.                              of a page is the current number of lines in the
  2291.  Key                         Function(Switch Cursor)
  2292.  
  2293.                             of a page is the current number of lines in the
  2294.                              window.
  2295.  
  2296.  PGDN                        Scrolls down one page.
  2297.  
  2298.                              If the cursor is in the display window, the
  2299.                              source lines or assembly-language instructions
  2300.                              scroll down. If the cursor is in the dialog
  2301.                              window, the buffer of commands entered during
  2302.                              the session scrolls down. The cursor remains at
  2303.                              its current position in the window. The length
  2304.                              of a page is the current number of lines in the
  2305.                              window.
  2306.  
  2307.  HOME                        Scrolls to the top of the file, first local
  2308.                              variable, or beginning of the current command.
  2309.  
  2310.                              If the cursor is in the display or locals
  2311.                              window, the text scrolls to the start of the
  2312.  Key                         Function(Switch Cursor)
  2313.  
  2314.                             window, the text scrolls to the start of the
  2315.                              source file, program instructions, or local
  2316.                              variables. If the cursor is in the dialog window
  2317.                              and you are currently entering a command, the
  2318.                              cursor moves to the beginning of the line, right
  2319.                              after the prompt.
  2320.  
  2321.  CTRL+HOME                   Scrolls to the top of the file, first local
  2322.                              variable, or beginning of the command buffer.
  2323.  
  2324.                              This key produces the same effect that the HOME
  2325.                              key does, except that in the dialog window it
  2326.                              moves the cursor to the beginning of the command
  2327.                              buffer. The top of the command buffer may be
  2328.                              blank if you have not yet entered enough
  2329.                              commands to fill the buffer. The cursor remains
  2330.                              at its current position in the window.
  2331.  
  2332.  END                         Scrolls to the bottom of the file, last local
  2333.  Key                         Function(Switch Cursor)
  2334.  
  2335. END                         Scrolls to the bottom of the file, last local
  2336.                              variable, or the end of the current command.
  2337.  
  2338.                              If the cursor is in the display or locals
  2339.                              window, the text scrolls to the end of the
  2340.                              source file, program instructions, or local
  2341.                              variables. If the cursor is in the dialog window
  2342.                              and you are entering a command, the cursor moves
  2343.                              to the end of the command.
  2344.  
  2345.  CTRL+END                    Scrolls to the bottom of the file, to the last
  2346.                              local variables, or to the end of the command
  2347.                              buffer.
  2348.  
  2349.                              This key produces the same effect that the END
  2350.                              key does, except that in the dialog window, this
  2351.                              key moves the cursor to the end of the command
  2352.                              buffer.
  2353.  
  2354.  
  2355.  2.1.1.2  Changing the Screen with Keyboard Commands
  2356.  
  2357.  The following keys change the screen or switch to a different screen.
  2358.  
  2359.  
  2360. ╓┌───────────────────────────┌───────────────────────────────────────────────╖
  2361.  Key                         Function
  2362.  
  2363.  F1                          Displays initial on-line Help screen.
  2364.  
  2365.                              The Help system is discussed in Section 2.1.4.
  2366.                              You can also take advantage of the Help system
  2367.                              by using the Help menu, as mentioned in Section
  2368.                              2.1.3.9.
  2369.  
  2370.  F2                          Toggles the register window.
  2371.  
  2372.                              The window disappears if present, or appears if
  2373.                              absent. You can also toggle the register window
  2374.                              with the Register selection from the View menu,
  2375.  Key                         Function
  2376.  
  2377.                             with the Register selection from the View menu,
  2378.                              as described in Section 2.1.3.2.
  2379.  
  2380.  F3                          Switches between source, mixed, and asse
  2381.  
  2382.                              Source mode shows source code in the display
  2383.                              window, whereas assembly mode shows
  2384.                              assembly-language instructions. Mixed mode shows
  2385.                              both. You can also change modes with the Source,
  2386.                              Mixed, and Assembly selections from the View
  2387.                              menu, as described in Section 2.1.3.2.
  2388.  
  2389.  F4                          Switches to the output screen.
  2390.  
  2391.                              The output screen shows the output, if any, from
  2392.                              your program. Press any key to return to the
  2393.                              CodeView screen.
  2394.  
  2395.  
  2396.  2.1.1.3  Controlling Program Execution with Keyboard Commands
  2397.  
  2398.  The following keys set and clear breakpoints, trace through your program, or
  2399.  execute to a breakpoint.
  2400.  
  2401. ╓┌───────────────────────────┌───────────────────────────────────────────────╖
  2402.  Key                         Function
  2403.  
  2404.  F5                          Executes to the next breakpoint or to the end of
  2405.                              the program if no breakpoint is encountered.
  2406.  
  2407.                              This keyboard command corresponds to the Go
  2408.                              dialog command when it is given without a
  2409.                              destination breakpoint argument.
  2410.  
  2411.  F7                          Sets a temporary breakpoint on the line with the
  2412.                              cursor, and executes to that line (or to a
  2413.                              previously set breakpoint or the end of the
  2414.                              program if either is encountered before the
  2415.                              temporary breakpoint).
  2416.  
  2417.  Key                         Function
  2418.  
  2419. 
  2420.                              In source mode, if the line does not correspond
  2421.                              to code (for example, data declaration or
  2422.                              comment lines), the CodeView debugger sounds a
  2423.                              warning and ignores the command. This window
  2424.                              command corresponds to the Go dialog command
  2425.                              when it is given with a destination breakpoint.
  2426.  
  2427.  F8                          Executes a Trace command.
  2428.  
  2429.                              The CodeView debugger executes the next source
  2430.                              line in source mode or the next instruction in
  2431.                              assembly mode. If the source line or instruction
  2432.                              contains a call to a routine or interrupt, the
  2433.                              debugger starts tracing through the call (enters
  2434.                              the call and is ready to execute the first
  2435.                              source line or instruction). This command will
  2436.                              not trace into DOS function calls.
  2437.  
  2438.  Key                         Function
  2439.  
  2440. 
  2441.  F9                          Sets a breakpoint or clears a breakpoint on the
  2442.                              line with the cursor.
  2443.  
  2444.                              If the line does not currently have a
  2445.                              breakpoint, one is set on that line. If the line
  2446.                              already has a breakpoint, the breakpoint is
  2447.                              cleared. If the cursor is in the dialog window,
  2448.                              the CodeView debugger sounds a warning and
  2449.                              ignores the command. This window command
  2450.                              corresponds to the Breakpoint Set and Breakpoint
  2451.                              Clear dialog commands.
  2452.  
  2453.  F10                         Executes the Program Step command.
  2454.  
  2455.                              The debugger executes the next source line in
  2456.                              source mode or the next instruction in assembly
  2457.                              mode. If the source line or instruction contains
  2458.                              a call to a routine or interrupt, the debugger
  2459.  Key                         Function
  2460.  
  2461.                             a call to a routine or interrupt, the debugger
  2462.                              steps over the entire call (executes it to the
  2463.                              return) and is ready to execute the line or
  2464.                              instruction after the call.
  2465.  
  2466.  
  2467.  ───────────────────────────────────────────────────────────────────────────
  2468.  NOTE
  2469.     You can usually interrupt program execution by pressing either CTRL+BREAK
  2470.     or CTRL+C. These key combinations can be used to exit endless loops or to
  2471.     interrupt loops slowed by the Watchpoint or Tracepoint commands (see
  2472.     Chapter 8, "Managing Watch Statements"). CTRL+BREAK or CTRL+C may not
  2473.     work if your program has a special use for one or both of these key
  2474.     combinations. If you have an IBM Personal Computer AT (or an
  2475.     AT-compatible), you can use the SYSTEM-REQUEST key to interrupt execution
  2476.     regardless of your program's use of CTRL+BREAK and CTRL+C.
  2477.  ───────────────────────────────────────────────────────────────────────────
  2478.  
  2479.  2.1.1.4  Selecting from Menus with the Keyboard
  2480.  
  2481.  This section discusses how to make selections from menus with the keyboard.
  2482.  The effects of the selections are discussed in Section 2.1.3, "Using Menu
  2483.  Selections," below.
  2484.  
  2485.  The menu bar at the top of the screen has eleven titles: File, View, Search,
  2486.  Run, Watch, Options, Language, Calls, Help, Trace, and Go. The first nine
  2487.  titles are menus, and the last two are commands. The Trace and Go titles are
  2488.  provided primarily for mouse users.
  2489.  
  2490.  The four steps for opening a menu and making a selection are described
  2491.  below.
  2492.  
  2493.    1. To open a menu, press ALT and the mnemonic (the first letter) of the
  2494.       menu title. This can be accomplished either by pressing ALT first,
  2495.       releasing the key, and pressing the letter; or you can hold down ALT
  2496.       and then press the letter. For example, press ALT+S to open the Search
  2497.       menu. The menu title is highlighted, and a menu box listing the
  2498.       selections pops up below the title.
  2499.  
  2500.       The mnemonic is a single letter that represents the selection. In color
  2501.       displays, this letter is in red; in black-and-white displays, it is in
  2502.       bold. In most cases, but not all, the letter is simply the first letter
  2503.       of the name of the selection. You can type an uppercase or a lowercase
  2504.       letter for the same selection.
  2505.  
  2506.    2. There are two ways to make a selection from an open menu:
  2507.  
  2508.       a.   Press the DOWN ARROW key on the numeric keypad to move down the
  2509.            menu. The highlight will follow your movement. When the item you
  2510.            want is highlighted, press ENTER to execute the command.
  2511.            You can also press the UP ARROW key to move up the menu. If you
  2512.            move off the top or bottom of the menu, the highlight wraps around
  2513.            to the other end of the menu.
  2514.  
  2515.       b.   Press the key corresponding to the menu-selection mnemonic.
  2516.  
  2517.    3. After a selection is made from the menu, one of three things will
  2518.       happen:
  2519.  
  2520.       a.   For most menu selections, the choice is executed immediately.
  2521.  
  2522.       b.   The items on the View, Options, and Language menus have small
  2523.            double arrows next to them if the option is on, or no arrows if
  2524.            the option is off.  Choosing the item toggles the option.  The
  2525.            status of the arrows will be reversed the next time an option is
  2526.            chosen.
  2527.  
  2528.       c.   Some items require a response. In this case, there is another step
  2529.            in the menu-selection process.
  2530.  
  2531.    4. If the item you select requires a response, a dialog box opens when you
  2532.       select a menu item. Type your response to the prompt in the box and
  2533.       press ENTER. For example, the Find dialog box asks you to enter a
  2534.       regular expression (see Appendix A for a complete explanation of
  2535.       regular expressions).
  2536.  
  2537.       If your response is valid, the command will be executed. If you enter
  2538.       an invalid response, a message box will appear, telling you the problem
  2539.       and asking you to press a key. Press any key to make the message box
  2540.       disappear.
  2541.  
  2542.  At any point during the process of selecting a menu item, you can press
  2543.  ESCAPE to cancel the menu. While a menu is open, you can press the LEFT
  2544.  ARROW or RIGHT ARROW key to move from one menu to an adjacent menu, or to
  2545.  one of the command titles on the menu bar. Pressing ENTER without entering
  2546.  any characters in response to a message box will also cancel the menu.
  2547.  
  2548.  
  2549.  2.1.2  Executing Window Commands with the Mouse
  2550.  
  2551.  The CodeView debugger is designed to work with the Microsoft Mouse (it also
  2552.  works with some compatible pointing devices). By moving the mouse on a flat
  2553.  surface, you can move the mouse pointer in a corresponding direction on the
  2554.  screen. The following terms refer to the way you select items or execute
  2555.  commands with the mouse.
  2556.  
  2557.  
  2558.  Term                        Definition
  2559.  
  2560.  Point                       Move the mouse until the mouse pointer rests on
  2561.                              the item you want to select.
  2562.  
  2563.  Click                       Quickly press and release a mouse button while
  2564.                              pointing at an item you want to select.
  2565.  
  2566.  Drag                        Press a mouse button while on a selected item,
  2567.                              then hold the button down while moving the
  2568.                              mouse. The item moves in the direction of the
  2569.                              mouse movement. When the item you are moving is
  2570.                              where you want it, release the button; the item
  2571.                              will stay at that place.
  2572.  
  2573.  
  2574.  The CodeView debugger uses two mouse buttons. The terms "click Right,"
  2575.  "click Left," "click both," and "click either" are sometimes used to
  2576.  designate which buttons to use. When dragging, either button can be used.
  2577.  
  2578.  2.1.2.1  Changing the Screen with the Mouse
  2579.  
  2580.  You can change various aspects of the screen display by pointing to one of
  2581.  the following elements and then either clicking or dragging.
  2582.  
  2583. ╓┌───────────────────────────┌───────────────────────────────────────────────╖
  2584.  Item                        Action
  2585.  Item                        Action
  2586.  
  2587.  Single line separating      Drag the separator line up to increase the size
  2588.  display and dialog          of the dialog window while decreasing the size
  2589.  windows                     of the display window, or drag the line down to
  2590.                              increase the size of the display window while
  2591.                              decreasing the size of the dialog window. You
  2592.                              can eliminate either window completely by
  2593.                              dragging the line all the way up or down
  2594.                              (providing the cursor is not in the window you
  2595.                              want to eliminate).
  2596.  
  2597.  UP ARROW or DOWN ARROW      Point and click Left on one of the four arrows
  2598.  on the scroll bar           on the scroll bars to scroll up or down. If you
  2599.                              are in the display window, source code scrolls
  2600.                              up or down. If you are in the dialog window, the
  2601.                              buffer containing dialog commands entered during
  2602.                              the session scrolls up or down.
  2603.  
  2604.                              Click Left to scroll up or down just one line at
  2605.                              a time. Press Left and hold it down in order to
  2606.  Item                        Action
  2607.  
  2608.                             a time. Press Left and hold it down in order to
  2609.                              scroll continuously. Continuous scrolling is
  2610.                              easier to use when you want to scroll more than
  2611.                              a couple of lines. The scrolling stops as soon
  2612.                              as you release the mouse button.
  2613.  
  2614.  Scroll bar elevator         Each scroll bar has an "elevator," which is a
  2615.                              highlighted rectangle on the bar that can be
  2616.                              moved up or down with the mouse. In the display
  2617.                              window, the elevator indicates your relative
  2618.                              position in the source file; if you are in mixed
  2619.                              or assembly mode, the elevator indicates your
  2620.                              position in the executable file relative to the
  2621.                              instructions that correspond to the source file.
  2622.                              You can move quickly through the source file by
  2623.                              dragging the display window elevator up or down.
  2624.  
  2625.                              In the dialog window, the position of the
  2626.                              elevator does not have any significance.
  2627.  Item                        Action
  2628.  
  2629.                             elevator does not have any significance.
  2630.  
  2631.                              To move up one page (either in the display or
  2632.                              dialog window), click the scroll bar anywhere
  2633.                              above the elevator. To move down a page, click
  2634.                              the scroll bar anywhere below the elevator.
  2635.  
  2636.  
  2637.  2.1.2.2  Controlling Program Execution with the Mouse
  2638.  
  2639.  By clicking the following mouse items, you can set and clear breakpoints,
  2640.  trace through your program, execute to a breakpoint, or change flag bits.
  2641.  
  2642. ╓┌───────────────────────────┌───────────────────────────────────────────────╖
  2643.  Item                        Action
  2644.  
  2645.  Source line or              Point and click on a source line in source mode
  2646.  instruction                 or on an instruction in assembly mode to take
  2647.                              one of the following actions:
  2648.  Item                        Action
  2649.  
  2650.                             one of the following actions:
  2651.  
  2652.                              Button        Result
  2653.  
  2654.                              Click Left    If the line under the mouse cursor
  2655.                                            does not have a breakpoint, one is
  2656.                                            set there.  If the line already
  2657.                                            has a breakpoint, the breakpoint
  2658.                                            is removed. Lines with breakpoints
  2659.                                            are shown in high-intensity text.
  2660.  
  2661.                              Click Right   A temporary breakpoint is set on
  2662.                                            the line, and the CodeView
  2663.                                            debugger executes until it reaches
  2664.                                            the line (or until it reaches a
  2665.                                            previously set breakpoint or the
  2666.                                            end of the program if either is
  2667.                                            encountered before the temporary
  2668.                                            breakpoint).
  2669.  Item                        Action
  2670.  
  2671.                                           breakpoint).
  2672.  
  2673.                              If you click on a line that does not correspond
  2674.                              to code (for example, a declaration or comment),
  2675.                              the CodeView debugger will sound a warning and
  2676.                              ignore the command.
  2677.  
  2678.  "Trace" on menu bar         Point and click to trace the next instruction.
  2679.                              The kind of trace is determined by which button
  2680.                              is clicked:
  2681.  
  2682.                              Button        Result
  2683.  
  2684.                              Click Left    The Trace command is executed.
  2685.                                            The CodeView debugger executes
  2686.                                            the next source line in source
  2687.                                            mode or the next instruction in
  2688.                                            assembly mode. If the source line
  2689.                                            or instruction contains a call to
  2690.  Item                        Action
  2691.  
  2692.                                           or instruction contains a call to
  2693.                                            a routine or interrupt, the
  2694.                                            debugger starts tracing through
  2695.                                            the call (it enters the call and
  2696.                                            is ready to execute the first
  2697.                                            source line or instruction). This
  2698.                                            command will not trace into DOS
  2699.                                            function calls.
  2700.  
  2701.                              Click Right   The Program Step command is
  2702.                                            executed. The debugger executes
  2703.                                            the next source line in source
  2704.                                            mode, or the next instruction in
  2705.                                            assembly mode. If the source line
  2706.                                            or instruction contains a call to
  2707.                                            a routine or interrupt, the
  2708.                                            CodeView debugger steps over the
  2709.                                            entire call (it executes the call
  2710.                                            to the return) and is ready to
  2711.  Item                        Action
  2712.  
  2713.                                           to the return) and is ready to
  2714.                                            execute the line or instruction
  2715.                                            after the call.
  2716.  
  2717.                              These two commands are different only if the
  2718.                              current location is the start of a procedure, an
  2719.                              interrupt, or a call.
  2720.  
  2721.  "Go" on menu bar            Point and click either button to execute to the
  2722.                              next breakpoint, or to the end of the program if
  2723.                              no breakpoints are encountered.
  2724.  
  2725.  Flag in register window     Point to a flag name and click either button to
  2726.                              reverse the flag. If the flag bit is set, it
  2727.                              will be cleared; if the flag bit is cleared, it
  2728.                              will be set. The flag name is changed on the
  2729.                              screen to match the new status. If you are using
  2730.                              color mode, the color of the flag mnemonic will
  2731.                              also change. This command can only be used when
  2732.  Item                        Action
  2733.  
  2734.                             also change. This command can only be used when
  2735.                              the register window is open. Use the command
  2736.                              with caution since changing flag bits can change
  2737.                              program execution at the lowest level.
  2738.  
  2739.  
  2740.  ───────────────────────────────────────────────────────────────────────────
  2741.  NOTE
  2742.     You can usually interrupt program execution by pressing either CTRL+BREAK
  2743.     or CTRL+C. See the note in Section 2.1.1.3, "Controlling Program
  2744.     Execution with Keyboard Commands," for more information.
  2745.  ───────────────────────────────────────────────────────────────────────────
  2746.  
  2747.  2.1.2.3  Selecting from Menus with the Mouse
  2748.  
  2749.  This section discusses how to make selections from menus with the mouse. The
  2750.  effect of each selection is discussed in Section 2.1.3, "Using Menu
  2751.  Selections."
  2752.  
  2753.  The menu bar at the top of the screen has eleven titles: File, View, Search,
  2754.  Run, Watch, Options, Language, Calls, Help, Trace, and Go. The first nine
  2755.  are menus, and the last two are commands that you can execute by clicking
  2756.  with the mouse. The five steps for opening a menu and making a selection are
  2757.  described below:
  2758.  
  2759.    1. To open a menu, point to the title of the menu you want to select.
  2760.  
  2761.    2. With the mouse pointer on the title, press and hold down either mouse
  2762.       button. The selected title is highlighted and a menu box with a list of
  2763.       selections pops up below the title.
  2764.  
  2765.    3. Press and drag the mouse toward you. The highlight follows the mouse
  2766.       movement. You can move the highlight up or down in the menu box.
  2767.  
  2768.       If you move off the box, the highlight will disappear. However, as long
  2769.       as you do not release the button, you can move the pointer back onto
  2770.       the menu to make the highlight reappear.
  2771.  
  2772.    4. When the selection you want is highlighted, release the mouse button.
  2773.  
  2774.       When you release the button, the menu selection is executed. One of
  2775.       three things will happen:
  2776.  
  2777.       a.   For most menu selections, the choice is executed immediately.
  2778.  
  2779.       b.   The items on the View, Options, and Language menus have small
  2780.            double arrows next to them if the option is on, or no arrows if
  2781.            the option is off. Choosing the item toggles the option. The
  2782.            status of the arrows on a chosen item will appear reversed the
  2783.            next time you open the menu.
  2784.  
  2785.       c.   Some items require a response. In this case, there is another step
  2786.            in the menu-selection process.
  2787.  
  2788.    5. If the item you select requires a response, a dialog box with a prompt
  2789.       appears. Type your response and press ENTER or a mouse button. For
  2790.       example, if you select Find, the prompt will ask you to enter a regular
  2791.       expression (see Section 2.1.3.3, "The Search Menu," or Appendix A for
  2792.       an explanation of regular expressions).
  2793.  
  2794.       If your response is valid, the command will be executed. If you enter
  2795.       an invalid response in the dialog box, a message box will appear
  2796.       telling you the problem and asking you to press a key. Press any key or
  2797.       click a mouse button to make the message box disappear.
  2798.  
  2799.       Also, if you press ENTER without entering any characters, the message
  2800.       box will disappear.
  2801.  
  2802.  There are several shortcuts you can take when selecting menu items with the
  2803.  mouse. If you change your mind and decide not to select an item from a menu,
  2804.  just move off the menu and release the mouse button──the menu will
  2805.  disappear. You can move from one menu to another by dragging the pointer
  2806.  directly from the current menu to the title of the new menu.
  2807.  
  2808.  
  2809.  2.1.3  Using Menu Selections
  2810.  
  2811.  This section describes the selections on each of the CodeView menus. These
  2812.  selections can be made with the keyboard, as described in Section 2.1.1, or
  2813.  with the mouse, as described in Section 2.1.2.
  2814.  
  2815.  Note that although the Trace and Go commands appear on the menu bar, they
  2816.  are not menus. These titles are provided primarily for mouse users.
  2817.  
  2818.  2.1.3.1  The File Menu
  2819.  
  2820.  The File menu includes selections for working on the current source or
  2821.  program file. The File menu is shown in Figure 2.2, and the selections are
  2822.  explained below.
  2823.  
  2824. ╓┌───────────────────────────┌───────────────────────────────────────────────╖
  2825.  Selection                   Action
  2826.  
  2827.  Open                        Opens a new file.
  2828.  
  2829.                              When you make this selection, a dialog box
  2830.                              appears asking for the name of the new file you
  2831.                              want to open. Type the name of a source file, an
  2832.                              include file, or any other text file. The text
  2833.                              of the new file replaces the current contents of
  2834.                              the display window
  2835.  
  2836.                              (if you are in assembly mode, the CodeView
  2837.  Selection                   Action
  2838.  
  2839.                             (if you are in assembly mode, the CodeView
  2840.                              debugger will switch to source mode). When you
  2841.                              finish viewing the file, you can reopen the
  2842.                              original file. The last location and breakpoints
  2843.                              will still be marked when you return.
  2844.  
  2845.                              You may not need to open a new file to see
  2846.                              source files for a different module of your
  2847.                              program. The CodeView debugger automatically
  2848.                              switches to the source file of a module when
  2849.                              program execution enters that module. Although
  2850.                              switching source files is never necessary, it
  2851.                              may be desirable if you want to set breakpoints
  2852.                              or execute to a line in a module not currently
  2853.                              being executed.
  2854.  
  2855.                              Note that if the debugger cannot find the source
  2856.                              file when it switches modules, a dialog box
  2857.                              appears asking for a file specification for the
  2858.  Selection                   Action
  2859.  
  2860.                             appears asking for a file specification for the
  2861.                              source file. You can either enter a new file
  2862.                              specification if the file is in another
  2863.                              directory, or press ENTER if no source file
  2864.                              exists. If you press ENTER, the module can only
  2865.                              be debugged in assembly mode.
  2866.  
  2867.  DOS Shell                   Exits to a DOS shell. This where you can execute
  2868.                              DOS commands or executable files. To return to
  2869.                              the CodeView debugger, type exit at the DOS
  2870.                              command prompt. The CodeView screen reappears
  2871.                              with the same status it had when you left it.
  2872.  
  2873.                              The Shell Escape command works by saving the
  2874.                              current processes in memory and then executing a
  2875.                              second copy of C OMMAND.COM. This requires more
  2876.                              than 200K of free memory, since the debugger,
  2877.                              COMMAND.COM, symbol tables, and the debugged
  2878.                              program must all be saved in memory. If you do
  2879.  Selection                   Action
  2880.  
  2881.                             program must all be saved in memory. If you do
  2882.                              not have enough memory to execute the Shell
  2883.                              Escape command, an error message appears. Even
  2884.                              if you have enough memory to execute the
  2885.                              command, you may not have enough memory left to
  2886.                              execute large programs from the shell.
  2887.  
  2888.                              The Shell Escape command does not work under
  2889.                              certain conditions. See Section 11.7 for
  2890.                              additional information.
  2891.  
  2892.  Exit                        Terminates the debugger and returns to DOS.
  2893.  
  2894.  2.1.3.2  The View Menu
  2895.  
  2896.  The View menu includes selections for switching between source and assembly
  2897.  modes, and for switching between the debugging screen and the output screen.
  2898.  The corresponding function keys for menu selection are shown on the right
  2899.  side of the menu where appropriate. The View menu is shown in Figure 2.3,
  2900.  and the selections are explained below.
  2901.  
  2902.  ───────────────────────────────────────────────────────────────────────────
  2903.  NOTE
  2904.     The terms "source mode" and "assembly mode" apply to Microsoft Macro
  2905.     Assembler programs as well as to high-level-language programs. Source
  2906.     mode used with assembler programs shows the source code as originally
  2907.     written, including comments and directives. Assembly mode displays
  2908.     unassembled machine code, without symbolic information.
  2909.  
  2910.     The use of one mode or another affects Trace and Program Step commands,
  2911.     as explained in Chapter 5, "Executing Code."
  2912.  ───────────────────────────────────────────────────────────────────────────
  2913.  
  2914.  At all times exactly one of the following selections will have a small
  2915.  double arrow to the left of the name: Source, Mixed, and Assembly. This
  2916.  arrow indicates which of the three display modes is in use. If you select a
  2917.  mode when you are already in that mode, the selection will be ignored. The
  2918.  Registers selection may or may not have a double arrow to the left,
  2919.  depending on whether or not the register window is being displayed.
  2920.  
  2921.  Selection                   Action
  2922.  
  2923.  Source                      Changes to source mode (showing source lines
  2924.                              only).
  2925.  
  2926.  Mixed                       Changes to mixed mode (showing both unassembled
  2927.                              machine code and source lines).
  2928.  
  2929.  Assembly                    Changes to assembly mode (showing only
  2930.                              unassembled machine code).
  2931.  
  2932.  Registers                   Selecting this option will toggle the register
  2933.                              window on and off. You can also turn the
  2934.                              register on and off by pressing F2.
  2935.  
  2936.  Output                      Selecting this option will display the output
  2937.                              screen. The entire CodeView display will
  2938.                              temporarily disappear, but come back as soon as
  2939.                              you press any key. The Output command can also
  2940.                              be selected with F4.
  2941.  
  2942.  
  2943.  2.1.3.3  The Search Menu
  2944.  
  2945.  The Search menu includes selections for searching through text files for
  2946.  text strings and searching executable code for labels. The Search menu is
  2947.  shown in Figure 2.4, and the selections are explained below.
  2948.  
  2949. ╓┌───────────────────────────┌───────────────────────────────────────────────╖
  2950.  Selection                   Action
  2951.  
  2952.  Find                        Searches the current source file or other text
  2953.                              file for a specified regular expression. (This
  2954.                              selection can also be made without pulling down
  2955.                              a menu by pressing CTRL+F.)
  2956.  
  2957.                              When you make this selection, a dialog box opens
  2958.                              asking you to enter a regular expression. Type
  2959.                              the expression you want to search for and press
  2960.                              ENTER. The CodeView debugger starts at the
  2961.                              current or most recent cursor position in the
  2962.                              display window and searches for the expression.
  2963.  Selection                   Action
  2964.  
  2965.                             display window and searches for the expression.
  2966.  
  2967.                              If your entry is found, the cursor moves to the
  2968.                              first source line containing the expression. If
  2969.                              you are in assembly mode, the debugger
  2970.                              automatically switches to source mode when the
  2971.                              expression is found. If the entry is not found,
  2972.                              a message box opens, telling you the problem and
  2973.                              asking you to press a key (you can also click a
  2974.                              mouse button) to continue.
  2975.  
  2976.                              Regular expressions are a method of specifying
  2977.                              variable text strings. This method is similar to
  2978.                              the DOS method of using wild cards in file
  2979.                              names. Regular expressions are explained in
  2980.                              detail in Appendix A of this manual.
  2981.  
  2982.                              You can use the Search selections without
  2983.                              understanding regular expressions. Since text
  2984.  Selection                   Action
  2985.  
  2986.                             understanding regular expressions. Since text
  2987.                              strings are the simplest form of regular
  2988.                              expressions, you can simply enter a string of
  2989.                              characters as the expression you want to find.
  2990.                              For example, you could enter count if you wanted
  2991.                              to search for the word "count."
  2992.  
  2993.                              The following characters have a special meaning
  2994.                              in regular expressions: backslash (\), asterisk
  2995.                              (*), left bracket ([), period (.), dollar sign
  2996.                              ($), and caret (^). In order to find strings
  2997.                              containing these characters, you must precede
  2998.                              the characters with a backslash; this cancels
  2999.                              their special meanings.
  3000.  
  3001.                              For example, the periods in FORTRAN relational
  3002.                              and logical operators must be preceded by
  3003.                              back-slashes. You would use \.EQ  to find the.EQ
  3004.                              operator. With C, you would use \*ptr  to find
  3005.  Selection                   Action
  3006.  
  3007.                             operator. With C, you would use \*ptr  to find
  3008.                              *ptr; with BASIC, you would use NAME\$ to find
  3009.                              NAME$.
  3010.  
  3011.                              The Case Sense selection from the Options menu
  3012.                              has no effect on searching for regular
  3013.                              expressions.
  3014.  
  3015.  Next                        Searches for the next match of the current
  3016.                              regular expression.
  3017.  
  3018.                              This selection is meaningful only after you have
  3019.                              used the Search command to specify the current
  3020.                              regular expression. If the CodeView debugger
  3021.                              searches to the end of the file without finding
  3022.                              another match for the expression, it wraps
  3023.                              around and starts searching at the beginning of
  3024.                              the file.
  3025.  
  3026.  Selection                   Action
  3027.  
  3028. 
  3029.  Previous                    Searches for the previous match of the current
  3030.                              regular expression.
  3031.  
  3032.                              This selection is meaningful only after you have
  3033.                              used the Search command to specify the current
  3034.                              regular expression. If the debugger searches to
  3035.                              the beginning of the file without finding
  3036.                              another match for the expression, it wraps
  3037.                              around and starts searching at the end of the
  3038.                              file.
  3039.  
  3040.  Label                       Searches the executable code for an
  3041.                              assembly-language label.
  3042.  
  3043.                              If the label is found, the cursor moves to the
  3044.                              instruction containing the label. If you start
  3045.                              the search in source mode, the debugger will
  3046.                              switch to assembly mode to show a label in a
  3047.  Selection                   Action
  3048.  
  3049.                             switch to assembly mode to show a label in a
  3050.                              library routine or an assembly-language module.
  3051.  
  3052.  
  3053.  2.1.3.4  The Run Menu
  3054.  
  3055.  The Run menu includes selections for running your program. The Run menu is
  3056.  shown in Figure 2.5, and the selections are explained below.
  3057.  
  3058. ╓┌───────────────────────────┌───────────────────────────────────────────────╖
  3059.  Selection                   Action
  3060.  
  3061.  Start                       Starts the program from the beginning and runs
  3062.                              it.
  3063.  
  3064.                              Any previously set breakpoints or watch
  3065.                              statements will still be in effect. The CodeView
  3066.                              debugger will run your program from the
  3067.                              beginning to the first breakpoint, or to the end
  3068.  Selection                   Action
  3069.  
  3070.                             beginning to the first breakpoint, or to the end
  3071.                              of the program if no breakpoint is encountered.
  3072.                              This has the same effect as selecting Restart
  3073.                              (see the next selection), then entering the Go
  3074.                              command.
  3075.  
  3076.  Restart                     Restarts the current program, but does not begin
  3077.                              executing it.
  3078.  
  3079.                              You can debug the program again from the
  3080.                              beginning. Any previously set breakpoints or
  3081.                              watch statements will still be in effect.
  3082.  
  3083.  Execute                     Executes from the current instruction.
  3084.  
  3085.                              This is the same as the Execute dialog command
  3086.                              (E). To stop execution, press any key or a mouse
  3087.                              button.
  3088.  
  3089.  Selection                   Action
  3090.  
  3091. 
  3092.  Clear Breakpoints           Clears all breakpoints.
  3093.  
  3094.                              This selection may be convenient after selecting
  3095.                              Restart if you don't want to use previously set
  3096.                              breakpoints. Note that watch statements are not
  3097.                              cleared by this command.
  3098.  
  3099.  
  3100.  ───────────────────────────────────────────────────────────────────────────
  3101.  NOTE
  3102.     Although the Start and Restart selections retain breakpoints along with
  3103.     pass count and arguments, any instructions entered with the Assemble
  3104.     command will be overwritten by the original program.
  3105.  ───────────────────────────────────────────────────────────────────────────
  3106.  
  3107.  2.1.3.5  The Watch Menu
  3108.  
  3109.  The Watch menu includes selections for managing the watch window. Selections
  3110.  on this menu are also available with dialog commands. The Watch menu is
  3111.  shown in Figure 2.6, and the selections are explained below.
  3112.  
  3113. ╓┌───────────────────────────┌───────────────────────────────────────────────
  3114.  Selection                   Action
  3115.  
  3116.  Add Watch                   Adds a watch-expression statement to the watch
  3117.                              window. (This selection can also be made
  3118.                              directly, by pressing CTRL+W.)
  3119.  
  3120.                              A dialog window opens, asking for the
  3121.                              source-level expression (which may be simply a
  3122.                              variable) whose value you want to see displayed
  3123.                              in the watch window. Type the expression and
  3124.                              press ENTER or a mouse button. The statement
  3125.                              appears in the watch window in normal text. You
  3126.                              cannot specify a memory range to be displayed
  3127.                              with the Add Watch selection as with the Watch
  3128.                              dialog command.
  3129.  
  3130.                              You can specify the format in which the value
  3131.  Selection                   Action
  3132.  
  3133.                             You can specify the format in which the value
  3134.                              will be displayed. Type the expression, followed
  3135.                              by a comma and a CodeView format specifier. If
  3136.                              you do not give a format specifier, the CodeView
  3137.                              debugger displays the value in a default format.
  3138.                              See Chapter 6, "Examining Data and Expressions,"
  3139.                              for more information about format specifiers and
  3140.                              the default format. See Section 8.2, "Setting
  3141.                              Watch-Expression and Watch-Memory Statements,"
  3142.                              for more information about the Watch command.
  3143.  
  3144.  Watchpoint                  Adds a watchpoint statement to the window.
  3145.  
  3146.                              A dialog window opens, asking for the
  3147.                              source-level expression whose value you want to
  3148.                              test. The watchpoint statement appears in the
  3149.                              watch window in high-intensity text when you
  3150.                              enter the expression. A watchpoint is a
  3151.                              conditional breakpoint that causes execution to
  3152.  Selection                   Action
  3153.  
  3154.                             conditional breakpoint that causes execution to
  3155.                              stop when the expression becomes nonzero (true).
  3156.                              See Section 8.3, "Setting Watchpoints," for
  3157.                              more information.
  3158.  
  3159.  Tracepoint                  Adds a tracepoint statement to the watch window.
  3160.  
  3161.                              A dialog window opens, asking for the
  3162.                              source-level expression or memory range whose
  3163.                              value you want to test. The tracepoint statement
  3164.                              appears in the watch window in high-intensity
  3165.                              text when you enter the expression. A tracepoint
  3166.                              is a conditional breakpoint that causes
  3167.                              execution to stop when the value of a given
  3168.                              expression changes. You cannot specify a memory
  3169.                              range to be tested with the Tracepoint selection
  3170.                              as you can with the Tracepoint dialog command.
  3171.  
  3172.                              When setting a tracepoint expression, you can
  3173.  Selection                   Action
  3174.  
  3175.                             When setting a tracepoint expression, you can
  3176.                              specify the format in which the value will be
  3177.                              displayed. After the expression type a comma and
  3178.                              a format specifier. If you do not give a format
  3179.                              specifier, the CodeView debugger displays the
  3180.                              value in a default format. See Chapter 6,
  3181.                              "Examining Data and Expressions," for more
  3182.                              information about format specifiers and default.
  3183.                              See Section 8.4, "Setting Tracepoints," for
  3184.                              more information about tracepoints.
  3185.  
  3186.  Delete Watch                Deletes a statement from the watch window. (This
  3187.                              selection can also be made directly, by pressing
  3188.                              CTRL+U.)
  3189.  
  3190.                              A dialog window opens, showing the current watch
  3191.                              statements. If you are using a mouse, move the
  3192.                              pointer to the statement you want to delete and
  3193.                              click either button. If you are using the
  3194.  Selection                   Action
  3195.  
  3196.                             click either button. If you are using the
  3197.                              keyboard, press the UP ARROW or DOWN ARROW key
  3198.                              to move the highlight to the statement you want
  3199.                              to delete, then press ENTER.
  3200.  
  3201.  Delete All Watch            Deletes all statements in the watch window.
  3202.  
  3203.                              All watch, watchpoint, and tracepoint statements
  3204.                              are deleted, the watch window disappears, and
  3205.                              the display window is redrawn to take advantage
  3206.                              of the freed space on screen.
  3207.  
  3208.  
  3209.  2.1.3.6  The Options Menu
  3210.  
  3211.  The Options menu allows you to set options that affect various aspects of
  3212.  the behavior of the CodeView debugger. The Options menu is shown in Figure
  3213.  2.7, and the selections are explained below.
  3214.  
  3215.  Selections on the Options menu have small double arrows to the left of the
  3216.  selection name when the option is on. The status of the option (and the
  3217.  presence of the double arrows) is reversed each time you select the option.
  3218.  By default, the Flip/Swap and Bytes Coded options are on and the 386 option
  3219.  is off when you start the CodeView debugger. Depending on which language
  3220.  your main program is in, the debugger will automatically turn Case Sense on
  3221.  (if your program is in C) or off (if your program is in another language)
  3222.  when you start debugging.
  3223.  
  3224.  The selections from the Options menu are discussed below.
  3225.  
  3226. ╓┌───────────────────────────┌───────────────────────────────────────────────
  3227.  Selection                   Action
  3228.  
  3229.  Flip/Swap                   When on (the default), screen swapping or screen
  3230.                              flipping (whichever the debugger was started
  3231.                              with) is active; when off, swapping or flipping
  3232.                              is disabled.
  3233.  
  3234.                              Turning off swapping or flipping makes the
  3235.                              screen scroll more smoothly. You will not see
  3236.  Selection                   Action
  3237.  
  3238.                             screen scroll more smoothly. You will not see
  3239.                              the program flip or swap each time you execute
  3240.                              part of the program. This option has no effect
  3241.                              if neither swapping nor flipping was selected
  3242.                              during start-up.
  3243.  
  3244.                              ───────────────────────────────────────────────
  3245.                              WARNING
  3246.                                 Any time your program writes to the screen,
  3247.                                 make sure flipping or swapping is on. If
  3248.                                 swapping and flipping are off, your program
  3249.                                 writes the output at the location of the
  3250.                                 cursor. The CodeView debugger detects the
  3251.                                 screen has changed and redraws the screen,
  3252.                                 thus destroying the program output. An error
  3253.                                 message is also displayed: Flip/Swap
  3254.                                 option off - application output lost.
  3255.                              ───────────────────────────────────────────────
  3256.  
  3257.  Selection                   Action
  3258.  
  3259. 
  3260.  Bytes Coded                 When on (the default), the instructions,
  3261.                              instruction addresses, and the bytes for each
  3262.                              instruction are shown; when off, only the
  3263.                              instructions are shown.
  3264.  
  3265.                              This option affects only assembly mode. The
  3266.                              following display shows the appearance of sample
  3267.                              code when the option is off:
  3268.  
  3269.                              The following display shows the appearance of
  3270.                              the same code when the option is on:
  3271.  
  3272.                              27:              name = gets(namebuf);<R>
  3273.                                        LEA       AX,Word Ptr [namebuf]<R>
  3274.                                        PUSH      AX<R>
  3275.                                        CALL      _gets (03E1)<R>
  3276.                                        ADD       SP,02<R>
  3277.                                        MOV       Word Ptr [name],AX
  3278.  Selection                   Action
  3279.  
  3280.                                       MOV       Word Ptr [name],AX
  3281.  
  3282.                              The following display shows the appearance of
  3283.                              the same code when the option is on:
  3284.  
  3285.                              27:              name = gets(namebuf);
  3286.                              32AF:003E 8D46DE    LEA   AX,Word Ptr [namebuf]
  3287.                              32AF:0041 50        PUSH  AX
  3288.                              32AF:0042 E89C03    CALL  _gets (03E1)
  3289.                              32AF:0045 83C402    ADD   SP,02
  3290.                              32AF:0048 8946DA    MOV   Word Ptr [name],AX
  3291.  
  3292.  Case Sense                  When the selection is turned on, the CodeView
  3293.                              debugger assumes that symbol names are case
  3294.                              sensitive (each lowercase letter is different
  3295.                              from the corresponding uppercase letter); when
  3296.                              off, symbol names are not case sensitive.
  3297.  
  3298.                              This option is on by default for C programs and
  3299.  Selection                   Action
  3300.  
  3301.                             This option is on by default for C programs and
  3302.                              off by default for FORTRAN, BASIC, and assembly
  3303.                              programs. You will probably want to leave the
  3304.                              option in its default setting.
  3305.  
  3306.  386 (DOS Only)              When on, the register window will display the
  3307.                              registers in the wider, 386 format. Furthermore,
  3308.                              this option will enable you to assemble and
  3309.                              execute instructions that reference 32-bit
  3310.                              registers. If the 386 option is not on, any data
  3311.                              stored in the high-order word of a 32-bit
  3312.                              register will be lost.
  3313.  
  3314.                              To use this option, you should have a 386
  3315.                              processor running in 386 mode. If you do not
  3316.                              have a 386 processor, the debugger will respond
  3317.                              with the message, CPU is not an 80386, and leave
  3318.                              the option turned off.
  3319.  
  3320.  
  3321.  2.1.3.7  The Language Menu
  3322.  
  3323.  The Language menu allows you to either select the expression evaluator or
  3324.  instruct the CodeView debugger to select it for you automatically. The
  3325.  Language menu is shown in Figure 2.8, and the selections are explained
  3326.  below.
  3327.  
  3328.  As with the Options menu, the selection on is marked by double arrows.
  3329.  Unlike the Options menu, however, exactly one item (and no more) on the
  3330.  Language menu is selected at any given time.
  3331.  
  3332.  The Auto selection causes the debugger to select automatically the
  3333.  expression evaluator each time a new source file is loaded. The debugger
  3334.  will examine the extension of the source file in order to determine which
  3335.  expression evaluator to select. The Auto selection will use the C expression
  3336.  evaluator if the current source file does not have a .BAS, .F, .FOR, or .PAS
  3337.  extension.
  3338.  
  3339.  If you change to a source module with an .ASM extension, Auto will cause the
  3340.  debugger to select the C expression evaluator, but not all of the C defaults
  3341.  will be used; system radix will be hexadecimal, case sensitivity will be
  3342.  turned off, and the register window will be displayed.
  3343.  
  3344.  When a language expression evaluator is selected, the debugger uses that
  3345.  evaluator, regardless of what kind of program is being debugged.
  3346.  
  3347.  2.1.3.8  The Calls Menu
  3348.  
  3349.  The Calls menu is different from other menus in that its contents and size
  3350.  change depending on the status of your program. The Calls menu is shown in
  3351.  Figure 2.9.
  3352.  
  3353.  The mnemonic for each item in the Calls menu is a number. Type the number
  3354.  displayed immediately to the left of a routine in order to select it. You
  3355.  can also use the UP ARROW or DOWN ARROW key to move to your selection, and
  3356.  then press ENTER. You can use the mouse to select from the Calls menu as
  3357.  well.
  3358.  
  3359.  The effect of making a selection from the Calls menu is to view a routine.
  3360.  The cursor will go to the line at which the selected routine was last
  3361.  executing. For example, selecting main in the example above will cause
  3362.  CodeView to display main, at the point at which main made a call to calc
  3363.  (the function immediately above it). Note that selecting a routine from the
  3364.  Calls menu does not (by itself) affect program execution. It simply provides
  3365.  a convenient way to view previously called routines.
  3366.  
  3367.  It is not required that one of the routines be selected. The Calls menu is
  3368.  useful for viewing the list of previously called routines.
  3369.  
  3370.  The Calls menu shows the current routine and the trail of routines from
  3371.  which it was called. The current routine is always at the top. The routine
  3372.  from which the current routine was called is directly below. Other active
  3373.  routines are shown in the reverse order in which they were called. With C
  3374.  and FORTRAN programs, the bottom routine should always be main. (The only
  3375.  time main will not be the bottom routine is when you are tracing through the
  3376.  standard library's start-up or termination routines.)
  3377.  
  3378.  The current value of each argument, if any, is shown in parentheses
  3379.  following the routine. The menu expands to accommodate the arguments of the
  3380.  widest routine. Arguments are shown in the current radix (the default is
  3381.  decimal). If there are more active routines than will fit on the screen, or
  3382.  if the routine arguments are too wide, the display will expand to both the
  3383.  left and right. The Stack Trace dialog command (K) also shows all the
  3384.  routines and arguments.
  3385.  
  3386.  ───────────────────────────────────────────────────────────────────────────
  3387.  NOTE
  3388.     If you are using the CodeView debugger to debug assembly-language
  3389.     programs, routines will be shown in the Calls menu only if they use one
  3390.     of the Microsoft calling conventions. These calling conventions are
  3391.     explained in the Microsoft Mixed-Language Programming Guide.
  3392.  ───────────────────────────────────────────────────────────────────────────
  3393.  
  3394.  2.1.3.9  The Help Menu
  3395.  
  3396.  The Help menu lists the major topics in the on-line Help. For Help, open the
  3397.  Help menu and select the topic you want to view.
  3398.  
  3399.  Each topic may have any number of subtopics. You must go to the major topic
  3400.  first. Information on how to move around within the help system is provided
  3401.  in the next section.
  3402.  
  3403.  The bottom selection on the Help menu is the About command. When you make
  3404.  this selection, the debugger displays a small box at the center of the
  3405.  screen that gives the time, the name of the product, and the version number.
  3406.  
  3407.  
  3408.  2.1.4  Using On-Line Help
  3409.  
  3410.  The CodeView on-line Help system uses tree-structured menus to give you
  3411.  quick access to help screens on a variety of subjects. Help uses a
  3412.  combination of menu access and sequentially linked screens, as explained
  3413.  below.
  3414.  
  3415.  The Help file is called CV.HLP. It must be present in the current directory
  3416.  or in one of the directories specified with the DOS PATH command. If the
  3417.  Help file is not found, the CodeView debugger will still operate, but you
  3418.  will not be able to use Help. An error message will appear if you try to use
  3419.  a Help command.
  3420.  
  3421.  When you request help, either by pressing F1, by using the H dialog command,
  3422.  or by selecting the Help menu, the first help screen appears. You can select
  3423.  Next and Previous buttons to page through the screens. The screens are
  3424.  arranged in a circular fashion, so that selecting Next on the last screen
  3425.  gets you to the first screen. Select the Cancel button to return to the
  3426.  CodeView screen. Pressing the PGDN, PGUP, and ESC keys achieves the same
  3427.  results as selecting Next, Previous, and Cancel, respectively, with the
  3428.  mouse.
  3429.  
  3430.  You can enter Help at a particular topic by selecting the topic from the
  3431.  Help menu. Once in Help, use Next and Previous to page to other screens.
  3432.  
  3433.  
  3434.  2.2  Using Sequential Mode
  3435.  
  3436.  Sequential mode is required if you have neither an IBM Personal Computer nor
  3437.  a closely compatible computer. In sequential mode, the CodeView debugger
  3438.  works much like its forerunner, the Microsoft Symbolic Debug Utility
  3439.  (SYMDEB) and the DOS DEBUG utility. Sequential mode is also useful when you
  3440.  are using redirected CodeView input and output.
  3441.  
  3442.  In sequential mode, the CodeView debugger's input and output always move
  3443.  down the screen from the current location. When the screen is full, the old
  3444.  output scrolls off the top of the screen to make room for new output
  3445.  appearing at the bottom. You can never return to examine previous commands
  3446.  once they scroll off, but in many cases, you can reenter the command to put
  3447.  the same information on the screen again.
  3448.  
  3449.  Most window commands cannot be used in sequential mode. However, the
  3450.  following function keys, which are used as commands in window mode, are also
  3451.  available in sequential mode.
  3452.  
  3453. ╓┌───────────────────────────┌───────────────────────────────────────────────╖
  3454.  Command                     Action
  3455.  
  3456.  F1                          Displays a command-syntax summary.
  3457.  
  3458.  F2                          Displays the registers.
  3459.  
  3460.                              This is equivalent to the Register (R) dialog
  3461.                              command.
  3462.  
  3463.  F3                          Toggles between source, mixed, and assembly
  3464.                              modes.
  3465.  
  3466.                              Pressing this key will rotate the mode between
  3467.  Command                     Action
  3468.  
  3469.                             Pressing this key will rotate the mode between
  3470.                              source, mixed, and assembly. You can achieve the
  3471.                              same effect by using the Set Assembly (S-), Set
  3472.                              Mixed (S&), and Set Source (S+) dialog commands.
  3473.  
  3474.  F4                          Switches to the output screen, which shows the
  3475.                              output of your program.
  3476.  
  3477.                              Press any key to return to the CodeView
  3478.                              debugging screen. This is equivalent to the
  3479.                              Screen Exchange (\) dialog command.
  3480.  
  3481.  F5                          Executes from the current instruction until a
  3482.                              breakpoint or the end of the program is
  3483.                              encountered.
  3484.  
  3485.                              This is equivalent to the Go dialog command (G)
  3486.                              with no argument.
  3487.  
  3488.  Command                     Action
  3489.  
  3490. 
  3491.  F8                          Executes the next source line in source mode, or
  3492.                              the next instruction in assembly mode.
  3493.  
  3494.                              If the source line or instruction contains a
  3495.                              function, procedure, or interrupt call, the
  3496.                              CodeView debugger executes the first source line
  3497.                              or instruction of the call and is ready to
  3498.                              execute the next source line or instruction
  3499.                              within the call. This is equivalent to the Trace
  3500.                              (T) dialog command.
  3501.  
  3502.  F9                          Sets or clears a breakpoint at the current
  3503.                              program location.
  3504.  
  3505.                              If the current program location has no
  3506.                              breakpoint, one is set. If the current location
  3507.                              has a breakpoint, it is removed. This is
  3508.                              equivalent to the Breakpoint Set (BP) dialog
  3509.  Command                     Action
  3510.  
  3511.                             equivalent to the Breakpoint Set (BP) dialog
  3512.                              command with no argument.
  3513.  
  3514.  F10                         Executes the next source line in source mode or
  3515.                              the next instruction in assembly mode.
  3516.  
  3517.                              If the source line or instruction contains a
  3518.                              function, procedure, or interrupt call, the call
  3519.                              is executed to the end, and the CodeView
  3520.                              debugger is ready to execute the line or
  3521.                              instruction after the call. This is equivalent
  3522.                              to the Program Step (P) dialog command.
  3523.  
  3524.  
  3525.  The CodeView Watch (W), Watchpoint (WP), and Tracepoint (TP) commands work
  3526.  in sequential mode, but since there is no watch window, the watch statements
  3527.  are not shown. You must use the Watch List command (W) to examine watch
  3528.  statements and watch values. See Chapter 8 for information on watch
  3529.  statement commands.
  3530.  
  3531.  All the CodeView commands that affect program operation (such as Trace, Go,
  3532.  and Breakpoint Set) are available in sequential mode. Any debugging
  3533.  operation done in window mode can also be done in sequential mode.
  3534.  
  3535.  
  3536.  Chapter 3  Using Dialog Commands
  3537.  ───────────────────────────────────────────────────────────────────────────
  3538.  
  3539.  CodeView dialog commands can be used in sequential mode or from the dialog
  3540.  window. In sequential mode, they are the primary method of entering
  3541.  commands. In window mode, dialog commands are used to enter commands that
  3542.  require arguments or do not have corresponding window commands.
  3543.  
  3544.  Many window commands have duplicate dialog commands. Generally, the window
  3545.  version of a command is more convenient, but the dialog version is more
  3546.  powerful.  For example, to set a breakpoint on a source line in window mode,
  3547.  put the cursor on the source line and press F9, or point to the line and
  3548.  click the left mouse button.  The dialog version of the Breakpoint command
  3549.  (BP) requires more keystrokes, but it allows you to specify an address, a
  3550.  pass count, and a string of commands to be taken whenever the breakpoint is
  3551.  encountered.
  3552.  
  3553.  The rest of this chapter explains how to enter dialog commands and how to
  3554.  select text on the screen for use with commands.
  3555.  
  3556.  
  3557.  3.1  Entering Commands and Arguments
  3558.  
  3559.  Dialog commands are entered at the CodeView prompt(>). Type the command and
  3560.  arguments and press ENTER.
  3561.  
  3562.  In window mode, you can enter commands whether or not the cursor is at the
  3563.  CodeView prompt. If the cursor is not in the dialog window, it moves to the
  3564.  dialog window as soon as you type text.
  3565.  
  3566.  
  3567.  3.1.1  Using Special Keys
  3568.  
  3569.  When entering dialog commands or viewing output from commands, you can use
  3570.  the following special keys:
  3571.  
  3572. ╓┌───────────────────────────┌───────────────────────────────────────────────╖
  3573.  Key                         Action
  3574.  
  3575.  CTRL+C                      Stops the current output or cancels the current
  3576.                              command line. For example, if you are watching a
  3577.                              long display from a Dump command, you can press
  3578.                              CTRL+C to interrupt the output and return to the
  3579.                              CodeView prompt. If you make a mistake while
  3580.                              entering a command, you can press CTRL+C to
  3581.                              cancel the command without executing it. A new
  3582.                              prompt appears, and you can reenter the command.
  3583.  
  3584.  CTRL+S                      Pauses during the output of a command. You can
  3585.                              press any key to continue output. For example,
  3586.                              if you are watching a long display from a Dump
  3587.                              command, you can press CTRL+S when a part of the
  3588.                              display appears that you want to examine more
  3589.                              closely. Then press any key when you are ready
  3590.                              for the output to continue scrolling.
  3591.  
  3592.  BACKSPACE                   Deletes the previous character on the command
  3593.  Key                         Action
  3594.  
  3595. BACKSPACE                   Deletes the previous character on the command
  3596.                              line and moves the cursor back one space. For
  3597.                              example, if you make an error while typing a
  3598.                              command, you can use the BACKSPACE key to delete
  3599.                              the characters back to the error──then retype
  3600.                              the remainder of the command.
  3601.  
  3602.  
  3603.  3.1.2  Using the Command Buffer
  3604.  
  3605.  In window mode, the CodeView debugger has a command buffer where the last
  3606.  2-4 screens of commands and command output are stored. The command buffer is
  3607.  not available in sequential mode.
  3608.  
  3609.  When the cursor is in the dialog window, you can scroll up or down to view
  3610.  the commands you have entered earlier in the session. The commands for
  3611.  moving the cursor and scrolling through the buffer are explained in sections
  3612.  2.1.1.1 and 2.1.2.1.
  3613.  
  3614.  Scrolling through the buffer is particularly useful for viewing the output
  3615.  from commands, such as Dump or Examine Symbols, whose output may scroll off
  3616.  the top of the dialog window.
  3617.  
  3618.  If you have scrolled through the dialog buffer to look at previous commands
  3619.  and output, you can still enter new commands. When you type a command, the
  3620.  cursor moves to the end of the command buffer and the text appears on a new
  3621.  line.
  3622.  
  3623.  When you start the debugger, the buffer is empty except for the copyright
  3624.  message. As you enter commands during the session, the buffer is gradually
  3625.  filled from the bottom to the top. If you have not filled the entire buffer
  3626.  and you press HOME to go to the top of the buffer, you will not see the
  3627.  first commands of the session. Instead you will see blank lines, since there
  3628.  is nothing at the top of the buffer.
  3629.  
  3630.  
  3631.  3.2  Format for CodeView Commands and Arguments
  3632.  
  3633.  The CodeView command format is similar to the format of the earlier
  3634.  Microsoft debuggers, SYMDEB and DEBUG. However, some features, particularly
  3635.  operators and expressions, are different. The general format for CodeView
  3636.  commands is shown below:
  3637.  
  3638.       command «arguments» «;command2»
  3639.  
  3640.  The command is a one-, two-, or three-character command name, and arguments
  3641.  are expressions that represent values or addresses to be used by the
  3642.  command. The command is not case sensitive; any combination of uppercase
  3643.  and lowercase letters can be used. However, arguments consisting of
  3644.  source-level expressions may or may not be case sensitive. (For example, C
  3645.  expressions are normally case sensitive; FORTRAN expressions are not. Case
  3646.  sensitivity can be affected by the language selected for expression
  3647.  evaluation.) Usually, the first argument can be placed immediately after
  3648.  command with no space separating the two fields.
  3649.  
  3650.  The number of arguments required or allowed with each command varies. If a
  3651.  command takes two or more arguments, you must separate the arguments with
  3652.  spaces. A semicolon (;) can be used as a command separator if you want to
  3653.  specify more than one command on a line.
  3654.  
  3655.  Examples
  3656.  
  3657.       DB 100 200      ;* Example 1
  3658.  
  3659.       >U Label1       ;* Example 2, C variable as argument
  3660.  
  3661.       >U SUM          ;* Example 3, FORTRAN variable as argument
  3662.  
  3663.       >U SUM; DB      ;* Example 4, multiple commands
  3664.  
  3665.  In Example 1, DB is the first command (for the Dump Bytes command). The
  3666.  arguments to the command are 100 and 200. The second command on this line is
  3667.  the Comment command (*). A semicolon is used to separate the two commands.
  3668.  The Comment command is used throughout the rest of the manual to number
  3669.  examples.
  3670.  
  3671.  In Example 2, U is the first command (for the Unassemble command), and the
  3672.  C-language variable Label1 is a command argument.
  3673.  
  3674.  In Example 3, U is again the first command (for the Unassemble command), and
  3675.  the FORTRAN variable SUM is a command argument.
  3676.  
  3677.  Example 4 consists of three commands, separated by semicolons. The first is
  3678.  the Unassemble command ( U) with the FORTRAN variable SUM as an argument.
  3679.  The second is the Dump Bytes command (DB) with no arguments. The third is
  3680.  the Comment command (*).
  3681.  
  3682.  
  3683.  3.3  Selecting Text for Use with Commands
  3684.  
  3685.  If you run CodeView in window mode, you can select text on the screen and
  3686.  use this same text as a command. This technique is useful for reusing a
  3687.  dialog command that is not among the last 20. Any text that appears in any
  3688.  window can be selected.
  3689.  
  3690.  To select and use text onscreen, follow these steps:
  3691.  
  3692.    1. Select text with either the mouse or keyboard.
  3693.  
  3694.       To select text with the mouse, move the mouse cursor to the beginning
  3695.       of the desired text, hold the left mouse button down and drag the mouse
  3696.       to the left. When you have dragged the mouse to the end of the desired
  3697.       text, release the button.
  3698.  
  3699.       To select text with the keyboard, move the cursor to the beginning of
  3700.       the desired text, hold the SHIFT key down, and move the cursor to the
  3701.       right. When the cursor is at the end of the desired text, release the
  3702.       SHIFT key and press ENTER.
  3703.  
  3704.    2. To use the selected text, press INS.
  3705.  
  3706.    3. Edit the command if desired, and press ENTER to execute.
  3707.  
  3708.  
  3709.  Chapter 4  CodeView Expressions
  3710.  ───────────────────────────────────────────────────────────────────────────
  3711.  
  3712.  CodeView command arguments are expressions that can include symbols,
  3713.  constant numbers, operators, and registers. Arguments can be simple
  3714.  machine-level expressions that directly specify an address or range in
  3715.  memory, or they can be source-level expressions that correspond to operators
  3716.  and symbols used in Microsoft C, FORTRAN, BASIC, or the Macro Assembler. For
  3717.  each high-level language (C, FORTRAN, and  BASIC), CodeView has an
  3718.  expression evaluator that computes the value of source-level expressions.
  3719.  
  3720.  Each of the three expression evaluators has a different set of operators and
  3721.  rules of precedence. However, the basic syntax for registers, addresses, and
  3722.  line numbers is the same regardless of the language.  You can always change
  3723.  the expression evaluator. If you specify a language other than the one used
  3724.  in the source file, the expression evaluator will still recognize your
  3725.  program symbols──if possible. (C and FORTRAN, however, will not accept BASIC
  3726.  type tags.) If you are debugging an assembly routine called from BASIC or
  3727.  FORTRAN, you may want to choose the language of the main program rather than
  3728.  C, the default for assembly programs.
  3729.  
  3730.  If the Auto option is on, the debugger examines the file extension of each
  3731.  new source file you trace through. Both C and assembly modules cause the
  3732.  debugger to select C as the expression evaluator.
  3733.  
  3734.  This chapter first deals with the expressions specific to each language.
  3735.  Line-number expressions are presented next; they work the same way
  3736.  regardless of the language. Then, register and address expressions are
  3737.  described. Generally, these do not have to be mastered unless you are doing
  3738.  assembly-level debugging. Finally, the chapter describes how to switch the
  3739.  expression evaluator.
  3740.  
  3741.  
  3742.  4.1  C Expressions
  3743.  
  3744.  The C expression evaluator uses a subset of the most commonly used C
  3745.  operators. It also supports the colon operator (:), which is described in
  3746.  Section 4.6.2, "Addresses," and the three memory operators (BY, WO, and DW),
  3747.  which are discussed in Section 4.7. The memory operators are primarily
  3748.  useful for debugging assembly source code. The CodeView C expression
  3749.  operators are listed in Table 4.1 in order of precedence. The superscripts
  3750.  a, b, and c refer to explanatory footnotes.
  3751.  
  3752.  Table 4.1  CodeView C Expression Operators
  3753. ╓┌───────────────┌───────────────────────────────────────────────────────────╖
  3754.  Precedence      Operators
  3755.  
  3756.  (Highest)
  3757.  
  3758.  1               ( )  [ ]  ->  .
  3759.  
  3760.  2               !  ~  -  (type) ++  -- *  &  sizeof
  3761.  Precedence      Operators
  3762. 2               !  ~  -  (type) ++  -- *  &  sizeof
  3763.  
  3764.  3               *  /  %  :
  3765.  
  3766.  4               +  -
  3767.  
  3768.  5               <  >  <=  >=
  3769.  
  3770.  6               ==  !=
  3771.  
  3772.  7               &&
  3773.  
  3774.  8               ||
  3775.  
  3776.  9               =   +=    -=     *=     /=     %=
  3777.  
  3778.  10              BY   WO   DW
  3779.  
  3780.  (Lowest)
  3781.  
  3782.  
  3783.  See the Microsoft C Compiler Language Reference for a description of how C
  3784.  operators can be combined with identifiers and constants to form
  3785.  expressions. With the C expression evaluator, the period (.) has its normal
  3786.  use as a member selection operator, but it also has an extended use as a
  3787.  specifier of local variables in parent functions. The syntax is shown below:
  3788.  
  3789.       function.variable
  3790.  
  3791.  The function must be a high-level-language function, and the variable must
  3792.  be a local variable within the specified function.  The variable cannot be a
  3793.  register variable. For example, you can use the expression main.argc to
  3794.  refer to the local variable argc when you are in a function that has been
  3795.  called by main.
  3796.  
  3797.  The type operator (used in type casting) can be any of the predefined C
  3798.  types. The CodeView debugger limits casts of pointer types to one level of
  3799.  indirection.  For example, (char *)sym is accepted, but (char **)sym is not.
  3800.  
  3801.  When a C expression is used as an argument with a command that takes
  3802.  multiple arguments, the expression should not have any internal spaces. For
  3803.  example, count+6 is allowed, but count + 6 may be interpreted as three
  3804.  separate arguments.  Some commands (such as the Display Expression command)
  3805.  do permit spaces in expressions.
  3806.  
  3807.  
  3808.  4.1.1  C Symbols
  3809.  
  3810.  Syntax
  3811.  
  3812.       name
  3813.  
  3814.  A symbol is a name that represents a register, a segment address, an offset
  3815.  address, or a full 32-bit address. At the C source level, a symbol is a
  3816.  variable name or the name of a function. Symbols (also called identifiers)
  3817.  follow the naming rules of the C compiler. Although CodeView command letters
  3818.  are not case sensitive, symbols given as arguments are case sensitive
  3819.  (unless you have turned off case sensitivity with the Case Sense selection
  3820.  from the Options menu).
  3821.  
  3822.  In assembly-language output or in output from the Examine Symbols command,
  3823.  the CodeView debugger displays some symbol names in the object-code format
  3824.  produced by the Microsoft C Compiler. This format includes a leading
  3825.  underscore. For example, the function main is displayed as _main. Only
  3826.  global labels (such as procedure names) are shown in this format. You do not
  3827.  need to include the underscore when specifying such a symbol in CodeView
  3828.  commands. Labels within library routines are sometimes displayed with a
  3829.  double underscore (__chkstk). You must use two leading underscores when
  3830.  accessing these labels with CodeView commands.
  3831.  
  3832.  
  3833.  4.1.2  C Constants
  3834.  
  3835.  Syntax
  3836.  
  3837.       digits                    Default radix
  3838.       0digits                   Octal radix
  3839.       0xdigits                  Hexadecimal radix
  3840.       0ndigits                  Decimal radix
  3841.  
  3842.  Numbers used in CodeView commands represent integer constants. They are made
  3843.  up of octal, hexadecimal, or decimal digits, and are entered in the current
  3844.  input radix.  The C-language format for entering numbers of different
  3845.  radixes can be used to override the current input radix.
  3846.  
  3847.  The default radix for the C expression evaluator is decimal.  However, you
  3848.  can use the Radix command (N) to specify an octal or hexadecimal radix, as
  3849.  explained in Section 11.3, "Radix Command."
  3850.  
  3851.  If the current radix is 16 (hexadecimal) or 8 (octal), you can enter decimal
  3852.  numbers in the special CodeView format 0ndigits. For example, you would
  3853.  enter 21 decimal as 0n21.
  3854.  
  3855.  With radix 16, it is possible to enter a value or argument that could be
  3856.  interpreted either as a symbol or as a hexadecimal number. The CodeView
  3857.  debugger resolves the ambiguity by searching first for a symbol (identifier)
  3858.  with that name.  If no symbol is found, the debugger interprets the value as
  3859.  a hexadecimal number.  If you want to enter a number that overrides an
  3860.  existing symbol, use the hexadecimal format (0xdigits).
  3861.  
  3862.  For example, if you enter abc as an argument when the program contains a
  3863.  variable or function named abc, the CodeView debugger interprets the
  3864.  argument as the symbol.  If you want to enter abc as a number, enter it as
  3865.  0xabc.
  3866.  
  3867.  Table 4.2 shows how a sample number (63 decimal) would be represented in
  3868.  each radix.
  3869.  
  3870.  Table 4.2  C Radix Examples
  3871.  
  3872.  Input Radix      Octal     Decimal     Hexadecimal
  3873.  
  3874.  8                77        0n63        0x3F
  3875.  
  3876.  10               077       63          0x3F
  3877.  
  3878.  16               077       0n63        3F
  3879.  
  3880.  
  3881.  4.1.3  C Strings
  3882.  
  3883.  Syntax
  3884.  
  3885.       "null-terminated-string"
  3886.  
  3887.  Strings can be specified as expressions in the C format.  You can use C
  3888.  escape characters within strings. For example, double quotation marks within
  3889.  a string are specified with the escape character \".
  3890.  
  3891.  Example
  3892.  
  3893.       EA message "This \"string\" is okay."
  3894.  
  3895.  The example uses the Enter ASCII command (EA) to enter the given string into
  3896.  memory starting at the address of the variable message.
  3897.  
  3898.  
  3899.  4.2  FORTRAN Expressions
  3900.  
  3901.  The FORTRAN expression evaluator uses a subset of the most commonly used
  3902.  FORTRAN operators. It also supports two additional operators, the period (.)
  3903.  and the colon (:). A number of FORTRAN intrinsic functions, which are listed
  3904.  in Section 4.2.4, are also supported. FORTRAN function calls are permitted,
  3905.  but statement function names and COMMON block names are not. (Note that
  3906.  these limitations only apply to the arguments of CodeView commands. They
  3907.  do not apply to the source program, which can contain any valid FORTRAN
  3908.  expression.)
  3909.  
  3910.  The CodeView FORTRAN operators are listed in Table 4.3 in order of
  3911.  precedence.
  3912.  
  3913.  Table 4.3  CodeView FORTRAN Operators
  3914. ╓┌───────────────┌───────────────────────────────────────────────────────────╖
  3915.  Precedence      Operators
  3916.  
  3917.  (Highest)
  3918.  
  3919.  1               ()
  3920.  
  3921.  2               .  :
  3922.  
  3923.  3               Unary  +  -
  3924.  
  3925.  4               *  /
  3926.  
  3927.  5               Binary  +  -
  3928.  
  3929.  Precedence      Operators
  3930.  
  3931. 
  3932.  6               .LT.  .LE.  .EQ.  .NE.  .GT.  .GE.
  3933.  
  3934.  7               .NOT.
  3935.  
  3936.  8               .AND.
  3937.  
  3938.  9               .OR.
  3939.  
  3940.  10              .EQV.  .NEQV.
  3941.  
  3942.  11              =
  3943.  
  3944.  (Lowest)
  3945.  
  3946.  
  3947.  The FORTRAN expression evaluator does not support the character
  3948.  concatenation operator (//) or the exponentiation operator (**). Relational
  3949.  operators are not supported for string variables or constants.
  3950.  
  3951.  The order and precedence with which the CodeView debugger evaluates FORTRAN
  3952.  expressions are the same as in the Microsoft FORTRAN language. See Chapter
  3953.  1, "Elements of FORTRAN" of the Microsoft FORTRAN Reference for a
  3954.  description of how FORTRAN operators can be combined with symbols and
  3955.  constants to form expressions.
  3956.  
  3957.  The colon operator (:) may be used when specifying a memory address. It acts
  3958.  as a segment:offset separator, as described in Section 4.6.2, "Addresses."
  3959.  
  3960.  In the CodeView debugger, the period (.) has an extended use as a specifier
  3961.  of local variables in parent routines. The syntax is shown below:
  3962.  
  3963.       routine.variable
  3964.  
  3965.  The routine must be a high-level-language routine and the variable must be a
  3966.  local variable within the specified routine. For example, you can use the
  3967.  expression main.X to refer to the local variable X in the procedure main if
  3968.  you are in a routine called by main. Note that in this example, main refers
  3969.  to the main routine of a FORTRAN or C program. It does not appear in FORTRAN
  3970.  source code.
  3971.  
  3972.  
  3973.  4.2.1  FORTRAN Symbols
  3974.  
  3975.  Syntax
  3976.  
  3977.       name
  3978.  
  3979.  A symbol is a name that represents a register, a segment address, an offset
  3980.  address, or a full 32-bit address. At the FORTRAN source level, a symbol is
  3981.  simply a variable name or the name of a routine; you do not necessarily need
  3982.  to know what kind of address it represents. When given as arguments, symbols
  3983.  are never case sensitive with the FORTRAN expression evaluator. If you have
  3984.  turned on case sensitivity with the Case Sense selection from the Options
  3985.  menu, it is turned off automatically when a symbol is used.
  3986.  
  3987.  In assembly-language output or in output from the Examine Symbols command,
  3988.  the CodeView debugger displays some symbol names in the object-code format
  3989.  produced by the Microsoft FORTRAN Optimizing Compiler. This format includes
  3990.  a leading underscore. For example, the main routine in your program is
  3991.  displayed as _main. Only global labels (such as procedure names) are shown
  3992.  in this format. You do not need to include the underscore when specifying
  3993.  such a symbol in CodeView commands. Labels within library routines are
  3994.  sometimes displayed with a double underscore (__chkstk). You must use
  3995.  leading underscores when accessing these labels with CodeView commands.
  3996.  
  3997.  
  3998.  4.2.2  FORTRAN Constants
  3999.  
  4000.  Syntax
  4001.  
  4002.       digits                      Default radix
  4003.       radix#digits                Specified radix
  4004.       #digits                     Hexadecimal radix
  4005.  
  4006.  Numbers used in CodeView commands represent integer constants. These
  4007.  constants are entered in the current input radix (base). When you are using
  4008.  the FORTRAN expression evaluator, the debugger will recognize any explicitly
  4009.  specified radix between 2 and 36 inclusive, as in 20#2G. The FORTRAN radix
  4010.  specifiers can be used to override the current radix. Note that a
  4011.  hexadecimal number may be entered in two ways. For example, 3F hex could be
  4012.  entered as either #3F or 16#3F. In this manual, the number sign alone is
  4013.  used to indicate hexadecimal numbers.
  4014.  
  4015.  The default radix for the FORTRAN version of the CodeView debugger is
  4016.  decimal. However, you can use the Radix command (N) to specify an octal or
  4017.  hexadecimal radix, as explained in Section 11.3, "Radix Command."
  4018.  
  4019.  With radix 16, it is possible to enter a value or argument that could be
  4020.  interpreted either as an identifier or as a hexadecimal number. The CodeView
  4021.  debugger resolves the ambiguity by searching first for a symbol (identifier)
  4022.  with that name. If no symbol is found, the debugger interprets the value as
  4023.  a hexadecimal number. If you want to enter a number that overrides an
  4024.  existing symbol, use the hexadecimal format (#digits).
  4025.  
  4026.  For example, if you enter ABC as an argument when the program contains a
  4027.  variable or function named ABC, the CodeView debugger interprets the
  4028.  argument as the symbol. If you want to enter ABC as a number, enter it as
  4029.  #ABC.
  4030.  
  4031.  Table 4.4 shows how a sample number (63 decimal) would be represented in the
  4032.  octal, decimal, and hexadecimal radixes.
  4033.  
  4034.  Table 4.4  FORTRAN Radix Examples
  4035.  
  4036.  Input Radix      Octal     Decimal     Hexadecimal
  4037.  
  4038.   8               77        10#63       #3F
  4039.  
  4040.  10               8#77      63          #3F
  4041.  
  4042.  16               8#77      10#63       3F
  4043.  
  4044.  
  4045.  4.2.3  FORTRAN Strings
  4046.  
  4047.  Syntax
  4048.  
  4049.       'string'
  4050.  
  4051.  Strings can be specified as character expressions in the FORTRAN format.
  4052.  Single quotation marks within a string must be specified by two single
  4053.  quotation marks.
  4054.  
  4055.  Example
  4056.  
  4057.       EA MESSAGE 'This ''string'' is okay.  '
  4058.  
  4059.  The example above uses the Enter ASCII command (EA) to enter the given
  4060.  string into memory, starting at the address of the variable MESSAGE. Notice
  4061.  that the string includes embedded single quotation marks and trailing
  4062.  blanks.
  4063.  
  4064.  
  4065.  4.2.4  FORTRAN Intrinsic Functions
  4066.  
  4067.  When entering a FORTRAN expression, you may use a limited number of FORTRAN
  4068.  intrinsic functions. The primary use of these functions is to convert a
  4069.  FORTRAN variable or value from one type to another for purposes of
  4070.  calculation. The intrinsic functions recognized by the expression evaluator
  4071.  of the CodeView debugger are listed in Table 4.5. See Chapter 5, "Intrinsic
  4072.  Functions and Additional Procedures" of the Microsoft FORTRAN Reference for
  4073.  a complete description of the FORTRAN intrinsic functions.
  4074.  
  4075.  Table 4.5  FORTRAN Intrinsic Functions Supported by the CodeView Debugger
  4076. ╓┌──────────────────────┌────────────────┌─────────────────────────┌─────────╖
  4077.                         Argument         Function
  4078.  Name                   Definition       Type                      Type
  4079.  
  4080.  CHAR(int)              Data-type        int                       char
  4081.  
  4082.                         conversion
  4083.  
  4084.  CMPLX(genA«,genB»)     Data-type        int, real, or cmp         cmp8
  4085.                         conversion
  4086.  
  4087.  DBLE(gen)              Data-type        int, real, or cmp         dbl
  4088.                         conversion
  4089.  
  4090.  DCMPLX(genA«,genB»)    Data-type        int, real, or cmp         cmp16
  4091.                         conversion
  4092.  
  4093.  DIMAG(cmp16)           Imaginary        cmp16                     dbl
  4094.                         part of cmp16
  4095.                         number
  4096.  
  4097.                         Argument         Function
  4098.  Name                   Definition       Type                      Type
  4099.  
  4100. 
  4101.  DREAL(cmp16)           Data-type        cmp16                     dbl
  4102.                         conversion
  4103.  
  4104.  ICHAR(char)            Data-type        char                      int
  4105.                         conversion
  4106.  
  4107.  IMAG(cmp)              Imaginary        cmp                       real
  4108.  
  4109.                         part of cmp
  4110.                         number
  4111.  
  4112.  INT(gen)               Data-type        int, real, or cmp         int
  4113.                         conversion
  4114.  
  4115.  INT1(gen)              Data-type        int, real, or cmp         int1
  4116.                         conversion
  4117.  
  4118.                         Argument         Function
  4119.  Name                   Definition       Type                      Type
  4120.  
  4121. 
  4122.  INT4(gen)              Data-type        int, real, or cmp         int4
  4123.                         conversion
  4124.  
  4125.  INTC(gen)              Data-type        int, real, or cmp         INTEGER[C]
  4126.                         conversion
  4127.  
  4128.  LOCFAR(gen)            Segmented        int, real, or cmp         int4
  4129.                         address
  4130.  
  4131.  LOCNEAR(gen)           Unsegmented      int, real, or cmp         int2
  4132.                         address
  4133.  
  4134.  REAL(gen)              Data-type        int, real, or cmp         real4
  4135.                         conversion
  4136.  
  4137.  
  4138.  4.3  BASIC Expressions
  4139.  
  4140.  The BASIC expression evaluator uses a subset of the most commonly used BASIC
  4141.  operators. It also supports one important BASIC command──the LET
  4142.  command──and one operator in addition to the BASIC operators──the colon (:).
  4143.  The CodeView BASIC operators are listed in Table 4.6 in order of precedence.
  4144.  
  4145.  Table 4.6  CodeView BASIC Operators
  4146. ╓┌───────────────┌───────────────────────────────────────────────────────────╖
  4147.  Precedence      Operators
  4148.  
  4149.  (Highest)
  4150.  
  4151.  1               ()
  4152.  
  4153.  2               .  :
  4154.  
  4155.  3               *  /
  4156.  
  4157.  4               \  MOD
  4158.  
  4159.  5               +  -
  4160.  Precedence      Operators
  4161.  
  4162. 5               +  -
  4163.  
  4164.  6               =  <>  <  >  <=  >=
  4165.  
  4166.  7               NOT
  4167.  
  4168.  8               AND
  4169.  
  4170.  9               OR
  4171.  
  4172.  10              XOR
  4173.  
  4174.  11              EQV
  4175.  
  4176.  12              IMP
  4177.  
  4178.  13              LET variable =
  4179.  
  4180.  (Lowest)
  4181.  Precedence      Operators
  4182.  
  4183. (Lowest)
  4184.  
  4185.  
  4186.  The BASIC expression evaluator does not support the exponentiation operator
  4187.  (^). Nor does it support string assignment, the string concatenation
  4188.  operator (+), or any of the relational operators (=,<,>,etc.), when used
  4189.  with strings. However, arrays, records, and user-defined types are all
  4190.  supported.
  4191.  
  4192.  The order and precedence with which the CodeView debugger evaluates BASIC
  4193.  expressions are the same as in the Microsoft BASIC language. See your BASIC
  4194.  documentation for a description of how BASIC operators can be combined with
  4195.  symbols and constants to form expressions.
  4196.  
  4197.  The assignment operator LET is supported for numerical operations only. When
  4198.  you use LET in a BASIC expression, the return value will not be useful.
  4199.  However, an assignment will take place whenever the expression is
  4200.  evaluated. This gives you a convenient way of manipulating data. For
  4201.  example, after the expression LET A = 5 is evaluated, the variable A will
  4202.  contain the value 5. You must use the keyword LET to specify assignment;
  4203.  otherwise, the BASIC expression evaluator will interpret the equal sign (=)
  4204.  as a test for equality.
  4205.  
  4206.  The colon operator (:) may be used to specify a memory address. It acts as a
  4207.  segment:offset separator, as described in Section 4.6.2, "Addresses."
  4208.  
  4209.  In the CodeView debugger, the period (.) has an extended use as a specifier
  4210.  of local variables in parent routines. The syntax is shown below:
  4211.  
  4212.       routine.variable
  4213.  
  4214.  The routine must be a high-level-language routine and the variable must be a
  4215.  local variable within the routine.
  4216.  
  4217.  When a BASIC expression is used as an argument with a command that takes
  4218.  multiple arguments, the expression should not have any internal spaces. For
  4219.  example, COUNT+6 is allowed, but COUNT+ 6 may be interpreted as three
  4220.  arguments. Some commands (such as the Display Expression command) only take
  4221.  one argument; these commands do permit spaces in expressions.
  4222.  
  4223.  
  4224.  4.3.1  BASIC Symbols
  4225.  
  4226.  Syntax
  4227.  
  4228.       name
  4229.  
  4230.  A symbol is a name that represents a register, a segment address, an offset
  4231.  address, or a full 32-bit address. At the BASIC source level, a symbol is
  4232.  simply a variable name or the name of a routine; you do not necessarily need
  4233.  to know what kind of address it represents. With the BASIC expression
  4234.  evaluator, symbols follow the naming rules of the BASIC compiler. In
  4235.  particular, all the type specifiers used in BASIC ($, %, &, !, and #) are
  4236.  accepted by the BASIC expression evaluator. Symbols are never case sensitive
  4237.  to BASIC, whether the Case Sense option is on or not.
  4238.  
  4239.  
  4240.  4.3.2  BASIC Constants
  4241.  
  4242.  Syntax
  4243.  
  4244.       fixed-point-string«#|!»        Single or double, fixed-point format
  4245.       floating-point-string«#| !»    Single or double, floating-point format
  4246.  
  4247.       digits                         Integer, default radix
  4248.       &Odigits                       Octal radix
  4249.       &digits                        Alternative octal radix
  4250.       &Hdigits                       Hexadecimal radix
  4251.  
  4252.  With the BASIC expression evaluator, numbers can be entered as integer,
  4253.  long, single-precision, or double-precision data objects. Constants are
  4254.  formed according to the rules of the Microsoft BASIC Compiler. A single- or
  4255.  double-precision constant must be entered in decimal radix, regardless of
  4256.  the current system radix. To enter a single or double, use the Microsoft
  4257.  BASIC rules for forming fixed and floating point strings.
  4258.  
  4259.  Integer constants are entered in the system radix and are made up of octal,
  4260.  decimal, or hexadecimal digits. You may override the system radix by using
  4261.  the octal, or hexadecimal prefix. In addition, you can use the & suffix on
  4262.  any integer constant to indicate that the integer is to be stored as a long
  4263.  (four-byte) integer, rather than as a short (two-byte) integer. To enter
  4264.  integers in the decimal format, the system radix must be 10, and you use the
  4265.  default radix. There is no way to enter decimal integers when the system
  4266.  radix is other than 10, unless you switch to another expression evaluator.
  4267.  
  4268.  The default radix for the BASIC expression evaluator is decimal. However,
  4269.  you can use the Radix command (N) to specify an octal or hexadecimal radix,
  4270.  as explained in Section 11.3, "Radix Command." With radix 16, it is possible
  4271.  to enter a value or argument that could be interpreted either as an
  4272.  identifier or as a hexadecimal number. The CodeView debugger resolves the
  4273.  ambiguity by searching first for a symbol (identifier) with that name. If no
  4274.  symbol is found, the debugger interprets the value as a hexadecimal number.
  4275.  If you want to enter a number that overrides an existing symbol, use the
  4276.  hexadecimal format (&Hdigits).
  4277.  
  4278.  For example, if you enter ABC as an argument when the program contains a
  4279.  variable or function named ABC, the CodeView debugger interprets the
  4280.  argument as the symbol. If you want to enter ABC as a number, enter it as
  4281.  &HABC.
  4282.  
  4283.  Table 4.7 shows how a sample number (63 decimal) would be represented in the
  4284.  octal, decimal, and hexadecimal radixes.
  4285.  
  4286.  Table 4.7  BASIC Radix Examples
  4287.  
  4288.  Input Radix      Octal     Decimal     Hexadecimal
  4289.  
  4290.  8                77        -           &H3F
  4291.  
  4292.  10               &O77      63          &H3F
  4293.  
  4294.  16               &O77      -           3F
  4295.  
  4296.  
  4297.  4.3.3  BASIC Strings
  4298.  
  4299.  The BASIC expression evaluator does not allow you to input strings while
  4300.  debugging. However, it does recognize both fixed and variable-length string
  4301.  variables, as defined by the BASIC compiler. (This includes arrays and
  4302.  records of strings.) Expressions that refer to strings will probably be
  4303.  quite simple, because string operators (concatenation and relational
  4304.  operators) are not supported by the BASIC expression evaluator.
  4305.  
  4306.  By using the Enter Address command, you can enter a string literal at a
  4307.  given address. To use this technique effectively, however, you will need to
  4308.  understand how BASIC handles string variables. For more information, see
  4309.  Chapter 6, "Examining Data and Expressions."
  4310.  
  4311.  
  4312.  4.3.4  BASIC Intrinsic Functions
  4313.  
  4314.  When entering a BASIC expression, you may use a limited number of BASIC
  4315.  intrinsic functions. The primary use of these functions is to convert a
  4316.  BASIC variable or value from one type to another for purposes of
  4317.  calculation. The intrinsic functions recognized by the expression evaluator
  4318.  of the CodeView debugger are listed in Table 4.8. See your BASIC compiler
  4319.  manual for a complete description of the BASIC intrinsic functions.
  4320.  
  4321.  Table 4.8  BASIC Intrinsic Functions Supported by the CodeView Debugger
  4322. ╓┌───────────────────────┌──────────────────────────┌────────────────────────
  4323.  
  4324.                                                     Argument
  4325.  Name                    Definition                 Type
  4326.  
  4327.  ASC                    ASCII value of first       string
  4328.  
  4329.                                                     Argument
  4330.  Name                    Definition                 Type
  4331. ASC                    ASCII value of first       string
  4332.                          character
  4333.  
  4334.  CDBL                    Data-type conversion       numerical expression
  4335.  
  4336.  CINT                    Conversion, with           numerical expression
  4337.                          rounding
  4338.  
  4339.  CSGN                    Data-type conversion       numerical expression
  4340.  
  4341.  CVI                     Data-type conversion       two-byte string
  4342.  
  4343.  CVL                     Data-type conversion       four-byte string
  4344.  
  4345.  CVS                     Data-type conversion       four-byte string
  4346.  
  4347.  CVD                     Data-type conversion       eight-byte string
  4348.  
  4349.  
  4350.                                                     Argument
  4351.  Name                    Definition                 Type
  4352. 
  4353.  FIX                     Conversion, with           numerical expression
  4354.                          truncation
  4355.  
  4356.  INT                     Conversion, with           numerical expression
  4357.                          truncation
  4358.  
  4359.  LBOUND(arr«,dim»)       Lowest index of array      array, dimension
  4360.  
  4361.  UBOUND(arr«,dim»)       Highest index of array     array, dimension
  4362.  
  4363.  VAL                     Numerical value of         string
  4364.                          string
  4365.  
  4366.  VARPTR                  Offset of variable         variable name
  4367.  
  4368.  VARSEG                  Segment of variable        variable name
  4369.  
  4370.  
  4371.  4.4  Assembly Expressions
  4372.  
  4373.  The /ZI option, available with Version 5.0 and later of the Microsoft Macro
  4374.  Assembler, provides variable size information for the CodeView debugger.
  4375.  This makes for correct evaluation of expressions derived from assembly code
  4376.  (except with arrays, which are discussed later in this section). If you have
  4377.  an earlier version of the Macro Assembler, you will need to use C type casts
  4378.  to get correct evaluation.
  4379.  
  4380.  When a program assembles or when the Auto switch is on, source files with an
  4381.  .ASM extension will cause CodeView to select the C expression evaluator.
  4382.  How-ever, the following options will be set differently from the C default
  4383.  options:
  4384.  
  4385.    ■  System radix is hexadecimal (not decimal).
  4386.  
  4387.    ■  Register window is on.
  4388.  
  4389.    ■  Case sense is off.
  4390.  
  4391.  The C expression evaluator supports the memory operators described in
  4392.  Section 4.7, and generally is the appropriate expression evaluator with
  4393.  which to debug assembly because of its flexibility.
  4394.  
  4395.  However, you cannot always use the C expression evaluator to specify an
  4396.  expression exactly as it would appear in assembly code. The list below
  4397.  describes the principal differences between assembler syntax and syntax used
  4398.  with the C expression evaluator.
  4399.  
  4400.  ───────────────────────────────────────────────────────────────────────────
  4401.  NOTE
  4402.     The examples below present expressions, not CodeView commands. You can
  4403.     see the results of these expressions by using them as operands for the
  4404.     Display Expression command (?), described in Chapter 6, "Examining Data
  4405.     and Expressions."
  4406.  ───────────────────────────────────────────────────────────────────────────
  4407.  
  4408.  In the following list, examples of assembly source code are shown in the
  4409.  left-hand column. Corresponding CodeView expressions (with the C expression
  4410.  evaluator) are shown in the right-hand column.
  4411.  
  4412.    1. Register indirection.
  4413.  
  4414.       The C expression evaluator does not extend the use of brackets to
  4415.       registers. To refer to the byte, word, or double word pointed to by a
  4416.       register, use the BY, WO, or DW operator.
  4417.  
  4418.            BYTE PTR [bx]                    BY bx
  4419.            WORD PTR [bp]                    WO bp
  4420.            DWORD PTR [bp]                   DW bp
  4421.  
  4422.    2. Register indirection with displacement.
  4423.  
  4424.       To perform based, indexed, or based-index indirection with a
  4425.       displacement, use either the BY, WO, or DW operator along with addition
  4426.       in a complex expression:
  4427.  
  4428.            BYTE PTR [di+6]                  BY di+6
  4429.            BYTE PTR [si][bp+6]              BY si+bp+6
  4430.            WORD PTR [bx][si]                WO bx+si
  4431.  
  4432.    3. Taking the address of a variable.
  4433.  
  4434.       Use the ampersand (&) to get the address of a variable with the C
  4435.       expression evaluator.
  4436.  
  4437.            OFFSET var                       &var
  4438.  
  4439.    4. The PTR operator.
  4440.  
  4441.       With the CodeView debugger, C type casts perform the same function as
  4442.       the assembler PTR operator.
  4443.  
  4444.            BYTE PTR var                      (char) var
  4445.            WORD PTR var                      (int) var
  4446.            DWORD PTR var                     (long) var
  4447.  
  4448.    5. Accessing array elements.
  4449.  
  4450.       Accessing arrays declared in assembly code is problematic because the
  4451.       Macro Assembler emits no type information to indicate which variables
  4452.       are arrays. Therefore the CodeView debugger treats an array name like
  4453.       any other variable.
  4454.  
  4455.       In C, an array name is equated with the address of the first element.
  4456.       Therefore, if you prefix an array with the address operator (&), the C
  4457.       expression evaluator gives correct results for array operations.
  4458.  
  4459.            string[12]                         (&string)[12]
  4460.            warray[bx+di]                      (&warray)(bx+di)/2
  4461.            darray[4]                          (&darray)[1]
  4462.  
  4463.       In the second and third examples above, notice that the indexes used
  4464.       in the assembly source-code expressions differ from the indexes used
  4465.       in the CodeView expressions. This difference is necessary because C
  4466.       arrays are automatically scaled according to the size of elements. In
  4467.       assembly, the program must do the scaling.
  4468.  
  4469.  
  4470.  4.5  Line Numbers
  4471.  
  4472.  Line numbers are useful for source-level debugging. They correspond to the
  4473.  lines in source-code files (BASIC, C, FORTRAN, or Macro Assembler). In
  4474.  source mode, you see a program displayed with each line numbered
  4475.  sequentially. The CodeView debugger allows you to use these same numbers to
  4476.  access parts of a program.
  4477.  
  4478.  Syntax
  4479.  
  4480.       .«filename:»linenumber
  4481.  
  4482.  The address corresponding to a source-line number can be specified as
  4483.  linenumber prefixed with a period (.). The CodeView debugger assumes that
  4484.  the source line is in the current source file, unless you specify the
  4485.  optional filename followed by a colon and the line number.
  4486.  
  4487.  The CodeView debugger displays an error message if filename does not exist,
  4488.  or if no source line exists for the specified number.
  4489.  
  4490.  Examples
  4491.  
  4492.       >V .100
  4493.  
  4494.  The example above uses the View command (V) to display code starting at the
  4495.  source line 100. Since no file is indicated, the current source file is
  4496.  assumed.
  4497.  
  4498.       >V .SAMPLE.FOR:10
  4499.  
  4500.       >V .EXAMPLE.BAS:22
  4501.  
  4502.       >V .DEMO.C:301
  4503.  
  4504.  The examples above use V to display source code starting at line 10 of
  4505.  SAMPLE.FOR, line 22 of EXAMPLE.BAS, and line 301 of DEMO.C, respectively.
  4506.  
  4507.  
  4508.  4.6  Registers and Addresses
  4509.  
  4510.  This section presents alternative ways to refer to objects in memory,
  4511.  including values stored in the processor's registers. Addresses are basic to
  4512.  each of the expression evaluators. A data symbol represents an address in a
  4513.  data segment; a procedure name represents an address in a code segment. All
  4514.  of the syntax in this section can be considered as an extension to the
  4515.  BASIC, C, or FORTRAN expression evaluator.
  4516.  
  4517.  
  4518.  4.6.1  Registers
  4519.  
  4520.  Syntax
  4521.  
  4522.       «@»register
  4523.  
  4524.  You can specify a register name if you want to use the current value stored
  4525.  in the register. Registers are rarely needed in source-level debugging, but
  4526.  they are used frequently for assembly-language debugging.
  4527.  
  4528.  When you specify an identifier, the CodeView debugger first checks the
  4529.  symbol table for a symbol with that name. If the debugger does not find a
  4530.  symbol, it checks to see if the identifier is a valid register name. If you
  4531.  want the identifier to be considered a register, regardless of any name in
  4532.  the symbol table, use the "at" sign (@) as a prefix to the register name.
  4533.  For example, if your program has a symbol called AX, you could specify @AX
  4534.  to refer to the AX register. You can avoid this problem entirely by making
  4535.  sure that identifier names in your program do not conflict with register
  4536.  names.
  4537.  
  4538.  The register names known to the CodeView debugger are shown in Table 4.9.
  4539.  Note that the 32-bit registers are available only if the 386 option is on
  4540.  and if the computer is a 386 machine running in 386 mode.
  4541.  
  4542.  Table 4.9  Registers
  4543.  
  4544.  Type                        Names
  4545.  
  4546.  8-bit high byte             AH   BH   CH   DH
  4547.  
  4548.  8-bit low byte              AL   BL   CL   DL
  4549.  
  4550.  16-bit general purpose      AX   BX   CX   DX
  4551.  
  4552.  16-bit segment              CS   DS   SS   ES
  4553.  
  4554.  16-bit pointer              SP   BP   IP
  4555.  
  4556.  16-bit index                SI   DI
  4557.  
  4558.  32-bit general purpose      EAX  EBX  ECX  EDX
  4559.  
  4560.  32-bit pointer              ESP  EBP
  4561.  
  4562.  32-bit index                ESI  EDI
  4563.  
  4564.  
  4565.  4.6.2  Addresses
  4566.  
  4567.  Syntax
  4568.  
  4569.       «segment:»offset
  4570.  
  4571.  Addresses can be specified in the CodeView debugger through the use of the
  4572.  colon operator as a segment:offset connector. Both the segment and the
  4573.  offset are made up of expressions.
  4574.  
  4575.  A full address has a segment and an offset, separated by a colon. A partial
  4576.  address has just an offset; a default segment is assumed. The default
  4577.  segment varies, depending on the command with which the address is used.
  4578.  Commands that refer to data (Dump, Enter, Watch, and Tracepoint) use the
  4579.  contents of the DS register. Commands that refer to code (Assemble,
  4580.  Breakpoint Set, Go, Unassemble, and View) use the contents of the CS
  4581.  register.
  4582.  
  4583.  Full addresses are seldom necessary in source-level debugging. Occasionally
  4584.  they may be convenient for referring to addresses outside the program, such
  4585.  as BIOS (basic input/output system) or DOS addresses.
  4586.  
  4587.  Examples
  4588.  
  4589.       >DB 100
  4590.  
  4591.  In the example above, the Dump Bytes command (DB) is used to dump memory
  4592.  starting at offset address 100. Since no segment is given, the data segment
  4593.  (the default for Dump commands) is assumed.
  4594.  
  4595.       >DB ARRAY(COUNT)     ;* FORTRAN/BASIC example
  4596.  
  4597.  In the example above, the Dump Bytes command is used to dump memory starting
  4598.  at the address of the variable ARRAY(COUNT). In C, a similar variable might
  4599.  be denoted as array[count].
  4600.  
  4601.       >DB label+10
  4602.  
  4603.  In the example above, the Dump Bytes command is used to dump memory starting
  4604.  at a point 10 bytes beyond the symbol label.
  4605.  
  4606.       >DB ES:200
  4607.  
  4608.  In the example above, the Dump Bytes command is used to dump memory at the
  4609.  address having the segment value stored in ES and the offset address 200.
  4610.  
  4611.  
  4612.  4.6.3  Address Ranges
  4613.  
  4614.  Syntax
  4615.  
  4616.       startaddress endaddress
  4617.       startaddress L count
  4618.  
  4619.  A "range" is a pair of memory addresses that bound a sequence of contiguous
  4620.  memory locations.
  4621.  
  4622.  You can specify a range in two ways. One way is to give the start and end
  4623.  points. In this case, the range covers startaddress to endaddress,
  4624.  inclusively. If a command takes a range, but if you do not supply a second
  4625.  address, the CodeView debugger usually assumes the default range. Each
  4626.  command has its own default range. (The most common default range is 128
  4627.  bytes.)
  4628.  
  4629.  You can also specify a range by giving its starting point and the number of
  4630.  objects you want included in the range. This type of range is called an
  4631.  object range. In specifying an object range, startaddress is the address of
  4632.  the first object in the list, L indicates that this is an object range
  4633.  rather than an ordinary range, and count specifies the number of objects in
  4634.  the range.
  4635.  
  4636.  The size of the objects is the size taken by the command. For example, the
  4637.  Dump Bytes command (DB) has byte objects, the Dump Words command (DW) has
  4638.  words, the Unassemble command (U) has instructions, and so on.
  4639.  
  4640.  Examples
  4641.  
  4642.       >DB buffer
  4643.  
  4644.  The example above dumps a range of memory starting at the symbol buffer.
  4645.  Since the end of the range is not given, the default size (128 bytes for the
  4646.  Dump Bytes command) is assumed.
  4647.  
  4648.       >DB buffer buffer+20
  4649.  
  4650.  The example above dumps a range of memory starting at buffer and ending at
  4651.  buffer+20 (the point 20 bytes beyond buffer).
  4652.  
  4653.       >DB buffer L 20
  4654.  
  4655.  The example above uses an object range to dump the same range as in the
  4656.  previous example. The L indicates that the range is an object range, and 20
  4657.  is the number of objects in the range. Each object has a size of 1 byte,
  4658.  since that is the command size.
  4659.  
  4660.       >U funcname-30 funcname
  4661.  
  4662.  The example above uses the Unassemble command (U) to list the
  4663.  assembly-language statements starting 30 instructions before funcname and
  4664.  continuing to funcname.
  4665.  
  4666.  
  4667.  4.7  Memory Operators
  4668.  
  4669.  Memory operators return the content of specific locations in memory. They
  4670.  are unary operators that work in the same way regardless of the language
  4671.  selected and return the result of a direct memory operation. They are
  4672.  chiefly of interest to programmers who debug in assembly mode, and are not
  4673.  necessary for high-level debugging.
  4674.  
  4675.  All of the operators listed in this section are part of the CodeView C
  4676.  expression evaluator and should not be confused with CodeView commands. As
  4677.  opera-tors, they can only build expressions, which in turn are used as
  4678.  arguments in commands.
  4679.  
  4680.  ───────────────────────────────────────────────────────────────────────────
  4681.  NOTE
  4682.     The memory operators discussed in this section are only available with
  4683.     the C expression evaluator and have the lowest precedence of any C
  4684.     operators.
  4685.  ───────────────────────────────────────────────────────────────────────────
  4686.  
  4687.  
  4688.  4.7.1  Accessing Bytes (BY)
  4689.  
  4690.  You can access the byte at an address by using the BY operator. This
  4691.  operator is useful for simulating the BYTE PTR operation of the Microsoft
  4692.  Macro Assembler. It is useful for watching the byte pointed to by a
  4693.  particular register.
  4694.  
  4695.  ───────────────────────────────────────────────────────────────────────────
  4696.  NOTE
  4697.     The examples that follow in this section make use of the Display
  4698.     Expression (?) Command, which is described in Section 6.1. The x format
  4699.     specifier causes the debugger to produce output in hexadecimal.
  4700.  ───────────────────────────────────────────────────────────────────────────
  4701.  
  4702.  Syntax
  4703.  
  4704.       BY address
  4705.  
  4706.  The result is a short integer that contains the value of the first byte
  4707.  stored at address.
  4708.  
  4709.  Examples
  4710.  
  4711.       >? BY sum
  4712.       101
  4713.  
  4714.  The example above returns the first byte at the address of sum.
  4715.  
  4716.       >? BY bp+6
  4717.       42
  4718.  
  4719.  This example returns the byte pointed to by the BP register, with a
  4720.  displacement of 6.
  4721.  
  4722.  
  4723.  4.7.2  Accessing Words (WO)
  4724.  
  4725.  You can access the word at an address by using the WO operator. This
  4726.  operator is useful for simulating the WORD PTR operation of the assembler.
  4727.  It is particularly useful for watching the word pointed to by a particular
  4728.  register, such as the stack pointer.
  4729.  
  4730.  Syntax
  4731.  
  4732.       WO address
  4733.  
  4734.  The result is a short integer that contains the value of the first two bytes
  4735.  stored at address.
  4736.  
  4737.  Examples
  4738.  
  4739.       >? WO sum
  4740.       >13120
  4741.  
  4742.  The example above returns the first word at the address of sum.
  4743.  
  4744.       >? WO sp,x
  4745.       >2F38
  4746.  
  4747.  This example returns the word pointed to by the stack pointer; the word
  4748.  therefore represents the last word pushed (the "top" of the stack).
  4749.  
  4750.  
  4751.  4.7.3  Accessing Double Words (DW)
  4752.  
  4753.  You can access the word at an address by using the DW operator. This
  4754.  operator is useful for simulating the DWORD PTR operation of the Microsoft
  4755.  Macro Assembler. It is particularly useful for watching the word pointed to
  4756.  by a particular register.
  4757.  
  4758.  Syntax
  4759.  
  4760.       DW address
  4761.  
  4762.  The result is a long integer that contains the value of the first four bytes
  4763.  stored at address.
  4764.  
  4765.  ───────────────────────────────────────────────────────────────────────────
  4766.  NOTE
  4767.     Be careful not to confuse the DW operator with the DW comm and. The
  4768.     operator is only useful for building expressions; it occurs within a
  4769.     CodeView command line, but never at the beginning. The second use of DW
  4770.     mentioned above, the Dump Words Command, occurs only at the beginning of
  4771.     a CodeView command line. It displays an entire range of memory (in words,
  4772.     not double words) rather than returning a single result.
  4773.  ───────────────────────────────────────────────────────────────────────────
  4774.  
  4775.  Examples
  4776.  
  4777.       >? DW sum
  4778.       >132120365
  4779.  
  4780.  The example above returns the first double word at the address of sum.
  4781.  
  4782.       >? DW si,x
  4783.       >3F880000
  4784.  
  4785.  This example returns the double word pointed to by the SI register.
  4786.  
  4787.  
  4788.  4.8  Switching Expression Evaluators
  4789.  
  4790.  The CodeView debugger allows you to specify a particular expression
  4791.  evaluator: BASIC, C, or FORTRAN. You may want to specify the expression
  4792.  evaluator if you are debugging a source module that does not use the
  4793.  standard extension of the source language (such as .C for C, .BAS for BASIC,
  4794.  etc.), or if you want to use a feature of a different language. For example,
  4795.  you might be debugging a C program and want to evaluate a string of binary
  4796.  digits. The FORTRAN expression evaluator accepts base 2, so you might want
  4797.  to switch temporarily to the FORTRAN expression evaluator.
  4798.  
  4799.  It is normally not necessary to specify the evaluator, even if you are
  4800.  debugging a mixed-language program; the Auto selection changes the
  4801.  expression evaluator for you.
  4802.  
  4803.  Mouse
  4804.  
  4805.  To switch expression evaluators with the mouse, open the Language menu and
  4806.  click the appropriate language selection.
  4807.  
  4808.  Keyboard
  4809.  
  4810.  To switch expression evaluators with a keyboard command, press ALT+L to open
  4811.  up the Language menu, use the direction keys (or mnemonic letter) to move to
  4812.  the appropriate language, then press RETURN.
  4813.  
  4814.  Dialog
  4815.  
  4816.  To switch expression evaluators using a dialog command, enter a command line
  4817.  with the syntax
  4818.  
  4819.       USE «language»
  4820.  
  4821.  where language is C, FORTRAN, BASIC, or Auto. The command is not case
  4822.  sensitive, and you can enter the language name in any combination of
  4823.  uppercase and lowercase letters. Entered on a line by itself, USE displays
  4824.  the name of the current expression evaluator. The USE command always
  4825.  displays the name of the current expression evaluator or the new expression
  4826.  evaluator (if specified).
  4827.  
  4828.  Examples
  4829.  
  4830.       >USE fortran
  4831.       FORTRAN
  4832.  
  4833.  The example above switches to the FORTRAN expression evaluator.
  4834.  
  4835.       >USE
  4836.       BASIC
  4837.  
  4838.  The example above displays the name of the current expression evaluator,
  4839.  which in this case happens to be BASIC.
  4840.  
  4841.  
  4842.  Chapter 5  Executing Code
  4843.  ───────────────────────────────────────────────────────────────────────────
  4844.  
  4845.  Several commands execute code within a program. Among the differences
  4846.  between the commands is the size of step executed by each. The commands and
  4847.  their step sizes are listed below.
  4848.  
  4849.    ■  Trace (T)
  4850.  
  4851.       Executes the current source line in source mode, or the current
  4852.       instruction in assembly mode; traces into routines, procedures, or
  4853.       interrupts
  4854.  
  4855.    ■  Program Step (P)
  4856.  
  4857.       Executes the current source line in source mode, or the current
  4858.       instruction in assembly mode; steps over routines, procedures, or
  4859.       interrupts
  4860.  
  4861.    ■  Go (G)
  4862.  
  4863.       Executes the current program
  4864.  
  4865.    ■  Execute (E)
  4866.  
  4867.       Executes the current program in slow motion
  4868.  
  4869.    ■  Restart (L)
  4870.  
  4871.       Restarts the current program
  4872.  
  4873.  
  4874.  5.1  Window and Sequential Mode Commands
  4875.  
  4876.  In window mode, the screen is updated to reflect changes that occur when you
  4877.  execute a Trace, Program Step, or Go command. The highlight marking the
  4878.  current location is moved to the new instruction in the display window. When
  4879.  appropriate, values are changed in the register and watch windows.
  4880.  
  4881.  In sequential mode, the current source line or instruction is displayed
  4882.  after each Trace, Program Step, or Go command. The format of the display
  4883.  depends on the display mode. The three display modes in sequential mode
  4884.  (source, assembly, and mixed) are discussed in Chapter 9, "Examining Code."
  4885.  
  4886.  If the display mode is source (S+) in sequential mode, the current source
  4887.  line is shown. If the display mode is assembly (S-), the status of the
  4888.  registers and the flags and the new instruction are shown in the format of
  4889.  the Register command (see Chapter 6, "Examining Data and Expressions"). If
  4890.  the display mode is mixed (S&), then the registers, the new source line, and
  4891.  the new instruction are all shown.
  4892.  
  4893.  The commands that execute code are explained in Sections 5.2-5.6.
  4894.  
  4895.  ───────────────────────────────────────────────────────────────────────────
  4896.  NOTE
  4897.     If you are executing a section of code with the Go or Program Step
  4898.     command, you can usually interrupt program execution by pressing
  4899.     CTRL+BREAK or CTRL+C. This can terminate endless loops, or it can
  4900.     interrupt loops that are delayed by the Watchpoint or Tracepoint command
  4901.     (see Chapter 8, "Managing Watch Statements").
  4902.  
  4903.     CTRL+BREAK or CTRL+C may not work if your program has a special use for
  4904.     either of these key combinations. If you have an IBM Personal Computer AT
  4905.     (or a compatible computer), you can use the SYSTEM-REQUEST key to
  4906.     interrupt execution regardless of your program's use of CTRL+BREAK and
  4907.     CTRL+C.
  4908.  ───────────────────────────────────────────────────────────────────────────
  4909.  
  4910.  
  4911.  5.2  Trace Command
  4912.  
  4913.  The Trace command executes the current source line in source mode, or the
  4914.  current instruction in assembly mode. The current source line or instruction
  4915.  is the one pointed to by the CS and IP registers. In window mode, the
  4916.  current instruction is shown in reverse video or in a contrasting color.
  4917.  
  4918.  In source mode, if the current source line contains a call, the CodeView
  4919.  debugger executes the first source line of the called routine. In this mode,
  4920.  the debugger will only trace into functions and routines that have source
  4921.  code. For example, if the current line contains a call to an intrinsic
  4922.  function or a standard C library function, the debugger will simply execute
  4923.  the function if you are in source mode, since the source code for Microsoft
  4924.  standard libraries is not available.
  4925.  
  4926.  If you are in assembly or mixed mode, the debugger will trace into the
  4927.  function. In this mode, if the current instruction is CALL, INT or REP, the
  4928.  debugger executes the first instruction of the procedure, interrupt, or
  4929.  repeated string sequence.
  4930.  
  4931.  ───────────────────────────────────────────────────────────────────────────
  4932.  NOTE
  4933.     When you debug Microsoft Macro Assembler programs in source mode, the
  4934.     paragraph above still applies. The debugger will not trace into an INT or
  4935.     REP sequence when you are in source mode.
  4936.  ───────────────────────────────────────────────────────────────────────────
  4937.  
  4938.  Use the Trace command i execute calls without tracing into them, you should
  4939.  use the Program Step command (P) instead. Both commands execute DOS function
  4940.  calls without tracing into them. There is no direct way to trace into DOS
  4941.  function calls. However, you can trace through BIOS calls in assembly or
  4942.  mixed mode.
  4943.  
  4944.  ───────────────────────────────────────────────────────────────────────────
  4945.  NOTE
  4946.     The Trace command (T) uses the hardware trace mode of the 8086 family of
  4947.     processors. Consequently, you can also trace instructions stored in ROM
  4948.     (read-only memory). However, the Program Step command (P) will not work
  4949.     in ROM.Using the Program Step command has the same effect as using the
  4950.     Gocommand (G).
  4951.  ───────────────────────────────────────────────────────────────────────────
  4952.  
  4953.  Mouse
  4954.  
  4955.  To execute the Trace command with the mouse, point to Trace on the menu bar
  4956.  and click Left.
  4957.  
  4958.  Keyboard
  4959.  
  4960.  To execute the Trace command with a keyboard command, press F8. This works
  4961.  in both window and sequential modes.
  4962.  
  4963.  Dialog
  4964.  
  4965.  To execute the Trace command using a dialog command, enter a command line
  4966.  with the following syntax:
  4967.  
  4968.       T «count»
  4969.  
  4970.  If the optional count is specified, the command executes count times before
  4971.  stopping.
  4972.  
  4973.  Example
  4974.  
  4975.  The following example shows the Trace command in sequential mode. (In window
  4976.  mode, there would be no output from the commands, but the display would be
  4977.  updated to show changes caused by the command.)
  4978.  
  4979.       S+       ;* FORTRAN example
  4980.       source
  4981.       >.
  4982.       9:        CALL INPUT (DATA,N,INPFMT)
  4983.       >T 3
  4984.       34:  OPEN (1,FILE='EXAMPLE.DAT',STATUS='OLD')
  4985.       35:       DO 100 I=1,N
  4986.       36:       READ (1,'(BN,I10)',END=999) DATA(I)
  4987.  
  4988.       >
  4989.  
  4990.  The FORTRAN example above sets the display mode to source, and then uses the
  4991.  Source Line command to display the current source line. (See Chapter 9,
  4992.  "Examining Code," for a further explanation of the Set Source and Source
  4993.  Line commands.) Note that the current source line calls the subroutine
  4994.  INPUT. The Trace command is then used to execute the next three source
  4995.  lines. These lines will be the first three lines of the subroutine INPUT.
  4996.  
  4997.  Debugging C and BASIC source code is very similar. If you execute the Trace
  4998.  command when the current source line contains a C function call or a BASIC
  4999.  subprogram call, the debugger will execute the first line of the called
  5000.  routine.
  5001.  
  5002.       S-
  5003.       assembly
  5004.       >T
  5005.       AX=0058  BX=3050  CX=000B  DX=3FB0  SP=304C  BP=3056  SI=00CC  DI=40E0
  5006.       DS=49B7  ES=49B7  SS=49B7  CS=3FB0  IP=0013  NV UP EI PL NZ AC PONC
  5007.       3FB0:0013 50             PUSH      AX
  5008.       >
  5009.  
  5010.  The example above sets the display mode to assembly and traces the current
  5011.  instruction. (This example and the next example are the same as the examples
  5012.  of the Program Step command in Section 5.3.) The Trace and Program Step
  5013.  commands behave differently only when the current instruction is a CALL,
  5014.  INT, or REP instruction.
  5015.  
  5016.       S&
  5017.       mixed
  5018.       >T
  5019.       AX=0000 BX=319C  CX=0028  DX=0000  SP=304C  BP=3056  SI=00CC  DI=40E0
  5020.       DS=49B7  ES=49B7  SS=49B7  CS=3FB0  IP=003C  NV UP EI PL NZ NA PONC
  5021.       8:        IF (N.LT.1 .OR. N.GT.1000) GO TO 100
  5022.       3FB0:003C 833ECE2101   CMP     Word Ptr [21CE],+01        DS:21CE=0028
  5023.       >
  5024.  
  5025.  The example above sets the display mode to mixed and traces the current
  5026.  instruction.
  5027.  
  5028.  
  5029.  5.3  Program Step Command
  5030.  
  5031.  The Program Step command executes the current source line in source mode, or
  5032.  the current instruction in assembly mode. The current source line or
  5033.  instruction is the one pointed to by the CS and IP registers. In window
  5034.  mode, the current instruction is shown in reverse video or in a contrasting
  5035.  color.
  5036.  
  5037.  In source mode, if the current source line contains a call, the CodeView
  5038.  debugger executes the entire routine and is ready to execute the line after
  5039.  the call. In assembly mode, if the current instruction is CALL, INT, or REP,
  5040.  the debugger executes the entire procedure, interrupt, or repeated string
  5041.  sequence.  Use the Program Step command if you want to execute over routine,
  5042.  function, procedure, and interrupt calls. If you want to trace into calls,
  5043.  you should use the Trace command (T) instead. Both commands execute DOS
  5044.  function calls without tracing into them. There is no direct way to trace
  5045.  into DOS function calls.
  5046.  
  5047.  Mouse
  5048.  
  5049.  To execute the Program Step command with the mouse, point to Trace on the
  5050.  menu bar and click Right.
  5051.  
  5052.  Keyboard
  5053.  
  5054.  To execute the Program Step command with a keyboard command, press F10. This
  5055.  works in both window and sequential modes.
  5056.  
  5057.  Dialog
  5058.  
  5059.  To execute the Program Step command with a dialog command, enter a command
  5060.  line with the following syntax:
  5061.  
  5062.       P «count»
  5063.  
  5064.  If the optional count is specified, the command executes count times before
  5065.  stopping.
  5066.  
  5067.  Example
  5068.  
  5069.  This example shows the Program Step command in sequential mode. In window
  5070.  mode, there would be no output from the commands, but the display would be
  5071.  updated to show changes.
  5072.  
  5073.       S+       ;* FORTRAN/BASIC example
  5074.       source
  5075.       >.
  5076.       9:        CALL INPUT (DATA,N,INPFMT)
  5077.       >P 3
  5078.       10:       CALL BUBBLE (DATA,N)
  5079.       11:       CALL STATS (DATA,N)
  5080.       12:       END
  5081.       >
  5082.  
  5083.  The example above (in FORTRAN or BASIC) sets the display mode to source, and
  5084.  then uses the Source Line command to display the current source line. (See
  5085.  Chapter 9, "Examining Code," for an explanation of the Set Source and
  5086.  Source Line commands.) Notice that the current source line calls the
  5087.  subprogram INPUT. The Program Step command is then used to execute the next
  5088.  three source lines. The first program step executes the entire subprogram
  5089.  INPUT. The next two steps execute the subprograms BUBBLE and STATS in their
  5090.  entirety.
  5091.  
  5092.  The same program, written in C, would behave exactly the same way with the
  5093.  Program Step command. The Program Step command will not trace into a C
  5094.  function call.
  5095.  
  5096.       S-
  5097.       assembly
  5098.       >P
  5099.       AX=0058 BX=3050  CX=000B  DX=3FB0  SP=304C  BP=3056  SI=00CC  DI=40E0
  5100.       DS=49B7  ES=49B7  SS=49B7  CS=3FB0  IP=0013  NV UP EI PL NZ AC PONC
  5101.       3FB0:0013 50             PUSH      AX
  5102.       >
  5103.  
  5104.  The example above sets the display mode to assembly and steps through the
  5105.  current instruction. (This example and the next example are the same as the
  5106.  examples of the Trace command in Section 5.2.) The Trace and Program Step
  5107.  commands behave differently only when the current instruction is a CALL,
  5108.  INT, or REP instruction.
  5109.  
  5110.       S&
  5111.       mixed
  5112.       >P
  5113.       AX=0000 BX=319C  CX=0028  DX=0000  SP=304C  BP=3056  SI=00CC  DI=40E0
  5114.       DS=49B7  ES=49B7  SS=49B7  CS=3FB0  IP=003C  NV UP EI PL NZ NA PONC
  5115.       8:        IF (N.LT.1 .OR. N.GT.1000) GO TO 100
  5116.       3FB0:003C 833ECE2101   CMP     Word Ptr [21CE],+01         DS:21CE=0028
  5117.       >
  5118.  
  5119.  The example above sets the display mode to mixed and steps through the
  5120.  current instruction.
  5121.  
  5122.  
  5123.  5.4  Go Command
  5124.  
  5125.  The Go command starts execution at the current address. There are two
  5126.  variations of the Go command──Go and Goto. The Go variation simply starts
  5127.  execution and continues to the end of the program or until a breakpoint set
  5128.  earlier with the Breakpoint Set (BP), Watchpoint (WP), or Tracepoint (TP)
  5129.  command is encountered. The other variation is a Goto command, in which a
  5130.  destination is given with the command.
  5131.  
  5132.  If a destination address is given but never encountered (for example, if the
  5133.  destination is on a program branch that is never taken), the CodeView
  5134.  debugger executes to the end of the program.
  5135.  
  5136.  If you enter the Go command and the debugger does not encounter a
  5137.  breakpoint, the entire program is executed and the following message is
  5138.  displayed:
  5139.  
  5140.       Program terminated normally  (number)
  5141.  
  5142.  The number in parentheses is the value returned by the program (sometimes
  5143.  called the exit or "errorlevel" code).
  5144.  
  5145.  Mouse
  5146.  
  5147.  To execute the Go command with no destination, point to Go on the menu bar
  5148.  and press either button.
  5149.  
  5150.  To execute the Goto variation of the Go command, point to the source line or
  5151.  instruction you wish to go to, then press the right button. The highlight
  5152.  marking the current location will move to the source line or instruction you
  5153.  pointed to (unless a breakpoint is encountered first). The CodeView debugger
  5154.  will sound a warning and take no action if you try to go to a comment line
  5155.  or other source line that does not correspond to code.
  5156.  
  5157.  If the line you wish to go to is in another module, you can use the Load
  5158.  command from the Files menu to load the source file for the other module.
  5159.  Then point to the destination line and press the right button.
  5160.  
  5161.  Keyboard
  5162.  
  5163.  To use a keyboard command to execute the Go command with no destination,
  5164.  press F5. This works in both window and sequential modes.
  5165.  
  5166.  To execute the Goto variation of the Go command, point to the source line or
  5167.  instruction you wish to go to then press the right button. The highlight
  5168.  marking the current location will move to the source line or instruction to
  5169.  which you wish to go. If the cursor is in the dialog window, first press F6
  5170.  to move the cursor to the display window. When the cursor is at the
  5171.  appropriate line in the display window, press F7. The highlight marking the
  5172.  current location will move to the source line or instruction you pointed to
  5173.  (unless a breakpoint is encountered first). If you try to go to a comment
  5174.  line or to another source line that does not correspond to code, the
  5175.  CodeView debugger will sound a warning and take no action.
  5176.  
  5177.  If the line you wish to go to is in another module, you can use the Load
  5178.  command from the Files menu to load the source file for the other module.
  5179.  Then move the cursor to the destination line and press F7.
  5180.  
  5181.  Dialog
  5182.  
  5183.  To execute the Go command with a dialog command, enter a command line with
  5184.  the following syntax:
  5185.  
  5186.       G «breakaddress»
  5187.  
  5188.  If the command is given with no argument, execution continues until a
  5189.  breakpoint or the end of the program is encountered.
  5190.  
  5191.  The Goto form of the command can be given by specifying breakaddress. The
  5192.  breakaddress can be given as a symbol, a line number, or an address in the
  5193.  segment:offset format. If the offset address is given without a segment, the
  5194.  address in the CS register is used as the default segment. If breakaddress
  5195.  is given as a line number, but the corresponding source line is a comment,
  5196.  declaration, or blank line, the following message appears:
  5197.  
  5198.       No code at this line number
  5199.  
  5200.  Examples
  5201.  
  5202.  The following examples show the Go command in sequential mode. In window
  5203.  mode there would be no output from the commands, but the display would be
  5204.  updated to show changes caused by the command.
  5205.  
  5206.       >G
  5207.  
  5208.       Program terminated normally (0)
  5209.       >
  5210.  
  5211.  The example above passes control to the instruction pointed to by the
  5212.  current values of the CS and IP registers. No breakpoint is encountered, so
  5213.  that the CodeView debugger executes to the end of the program, where it
  5214.  prints a termination message and the exit code returned by the program ( 0
  5215.  in the example).
  5216.  
  5217.       S+     ;* FORTRAN/BASIC example (source mode)
  5218.       source
  5219.       >G BUBBLE
  5220.       17:        A = B + C
  5221.       >
  5222.  
  5223.  In the example above, the display mode is first set to source (S+). (See
  5224.  Chapter 9, "Examining Code," for information on setting the display mode.)
  5225.  When the Go command is entered, the CodeView debugger starts program
  5226.  execution at the current address and continues until it reaches the start of
  5227.  the subprogram BUBBLE.
  5228.  
  5229.       S&     ;* C example (mixed mode)
  5230.       mixed
  5231.       >G .22
  5232.       AX=02F4  BX=0002  CX=00A8  DX=0000  SP=3036  BP=3042  SI=0070  DI=40E0
  5233.       DS=49B7  ES=49B7  SS=49B7  CS=3FB0  IP=0141  NV UP EI PL NZ NAPO NC
  5234.       22:        x[i] = x[j];
  5235.       3FB0:0141 8B7608       MOV     SI,Word Ptr [BP+08]         SS:304A=0070
  5236.       >
  5237.  
  5238.  The example above passes execution control to the program at the current
  5239.  address and executes to the address of source line 22. If the address with
  5240.  the breakpoint is never encountered (for example, if the program has less
  5241.  than 22 lines, or if the breakpoint is on a program branch that is never
  5242.  taken), the CodeView debugger executes to the end of the program.
  5243.  
  5244.       S-
  5245.       assembly
  5246.       >G #2A8
  5247.       AX=0049  BX=0049  CX=028F  DX=0000  SP=12F2  BP=12F6  SI=04BA  DI=1344
  5248.       DS=5DAF  ES=5DAF  SS=5DAF  CS=58BB  IP=02A8  NV UP EI PL NZ NA PENC
  5249.       58BB:02A8 98             CBW
  5250.       >
  5251.  
  5252.  The example above executes to the hexadecimal address CS:2A8. Since no
  5253.  segment address is given, the CS register is assumed.
  5254.  
  5255.  ───────────────────────────────────────────────────────────────────────────
  5256.  NOTE
  5257.     Mixed and source mode can be used equally well with all three languages.
  5258.     The examples alternate languages in this chapter simply to be accessible
  5259.     to more users.
  5260.  ───────────────────────────────────────────────────────────────────────────
  5261.  
  5262.  
  5263.  5.5  Execute Command
  5264.  
  5265.  The Execute command is similar to the Go command with no arguments except
  5266.  that it executes in slow motion (several source lines per second). Execution
  5267.  starts at the current address and continues to the end of the program or
  5268.  until a breakpoint, tracepoint, or watchpoint is reached. You can also stop
  5269.  automatic program execution by pressing any key or a mouse button.
  5270.  
  5271.  Mouse
  5272.  
  5273.  To execute code in slow motion with the mouse, point to Run on the menu bar,
  5274.  press a mouse button and drag the highlight down to the Execute selection,
  5275.  and then release the button.
  5276.  
  5277.  Keyboard
  5278.  
  5279.  To execute code in slow motion with a keyboard command, press ALT+R to open
  5280.  the Run menu, and then press ALT+E to select Execute.
  5281.  
  5282.  Dialog
  5283.  
  5284.  To execute code in slow motion with a dialog command, enter a command line
  5285.  with the following syntax:
  5286.  
  5287.       E
  5288.  
  5289.  You cannot set a destination for the Execute command as you can for the Go
  5290.  command.
  5291.  
  5292.  In sequential mode, the output from the Execute command depends on the
  5293.  display mode (source, assembly, or mixed). In assembly or mixed mode, the
  5294.  command executes one instruction at a time. The command displays the current
  5295.  status of the registers and the instruction. In mixed mode, it will also
  5296.  show a source line if there is one at the instruction. In source mode, the
  5297.  command executes one source line at a time, displaying the lines as it
  5298.  executes them.
  5299.  
  5300.  ───────────────────────────────────────────────────────────────────────────
  5301.  NOTE
  5302.     The Execute command has the same command letter (E)as the Enter command.
  5303.     If the command has at least one argument, it is interpreted as Enter; if
  5304.     not, it is interpreted as Execute.
  5305.  ───────────────────────────────────────────────────────────────────────────
  5306.  
  5307.  
  5308.  5.6  Restart Command
  5309.  
  5310.  The Restart command restarts the current program. The program is ready to be
  5311.  executed just as if you had restarted the CodeView debugger. Program
  5312.  variables are reinitialized, but any existing breakpoints or watch
  5313.  statements are retained. The pass count for all breakpoints is reset to 1.
  5314.  Any program arguments are also retained, though they can be changed with the
  5315.  dialog version of the command.
  5316.  
  5317.  The Restart command can only be used to restart the current program. If you
  5318.  wish to load a new program, you must exit and restart the CodeView debugger
  5319.  with the new program name.
  5320.  
  5321.  Mouse
  5322.  
  5323.  To restart the program with the mouse, point to Run on the menu bar, press a
  5324.  mouse button and drag the highlight down to the Restart or Start selection,
  5325.  and then release the button. The program will be restarted. If the Restart
  5326.  selection is chosen, the program will be ready to start executing from the
  5327.  beginning (but not actually running). If the Start selection is chosen, the
  5328.  program starts executing from the beginning and continues until a breakpoint
  5329.  or the end of the program is encountered.
  5330.  
  5331.  Keyboard
  5332.  
  5333.  To restart the program with a keyboard command, press ALT+R to open the Run
  5334.  menu, and then press either ALT+R to select Restart or ALT+S to select
  5335.  Start. The program will be restarted. If the Restart selection is chosen,
  5336.  the program will be ready to start executing from the beginning (but not
  5337.  actually running). If the Start selection is chosen, the program starts
  5338.  executing from the beginning and continues until a breakpoint or the end of
  5339.  the program is encountered.
  5340.  
  5341.  Dialog
  5342.  
  5343.  To restart the program with a dialog command, enter a command line with the
  5344.  following syntax:
  5345.  
  5346.       L «arguments»
  5347.  
  5348.  When you restart using the dialog version of the command, the program will
  5349.  be ready to start executing from the beginning. If you want to restart with
  5350.  new program arguments, you can give optional arguments. You cannot specify
  5351.  new arguments with the mouse or keyboard version of the command.
  5352.  
  5353.  ───────────────────────────────────────────────────────────────────────────
  5354.  NOTE
  5355.     The command letter L is a mnemonic for Load, but the command should not
  5356.     be confused with the Load selection from the File menu, since that
  5357.     selection only loads a source file without restarting the program.
  5358.  ───────────────────────────────────────────────────────────────────────────
  5359.  
  5360.  Examples
  5361.  
  5362.       L
  5363.       >
  5364.  
  5365.  The example above starts the current executable file, retaining any
  5366.  breakpoints, watchpoints, tracepoints, and arguments.
  5367.  
  5368.       L 6
  5369.       >
  5370.  
  5371.  The example above restarts the current executable file, but with 6 as the
  5372.  new program argument.
  5373.  
  5374.  
  5375.  Chapter 6  Examining Data and Expressions
  5376.  ───────────────────────────────────────────────────────────────────────────
  5377.  
  5378.  The CodeView debugger provides several commands for examining different
  5379.  kinds of data such as expressions, symbols, memory, and registers. The
  5380.  data-evaluation commands discussed in this chapter are summarized below.
  5381.  
  5382.  Command                     Action
  5383.  
  5384.  Display Expression (?)      Evaluates and displays locals, the value of
  5385.                              symbols, or expressions
  5386.  
  5387.  Graphic Display (??)        Displays local variables and complete data
  5388.                              structures in a scrollable dialog box and traces
  5389.                              pointer, structure, and array references
  5390.  
  5391.  Examine Symbol (X?)         Displays the addresses of symbols
  5392.  
  5393.  Dump (D)                    Displays sections of memory containing data
  5394.                              (with variations for examining different kinds
  5395.                              of data)
  5396.  
  5397.  Compare Memory (C)          Compares two blocks of memory, byte by byte
  5398.  
  5399.  Search Memory (S)           Scans memory for specified byte values
  5400.  
  5401.  Port Input (I)              Reads a byte from a hardware port
  5402.  
  5403.  Register (R)                Shows the current value of each register and
  5404.                              each flag (and optionally changes them)
  5405.  
  5406.  8087 (7)                    Shows the current value in the 8087 or 80287
  5407.                              register
  5408.  
  5409.  
  5410.  6.1  Display Expression Command
  5411.  
  5412.  The Display Expression command displays the value of a CodeView expression.
  5413.  
  5414.  Each of the expression evaluators (C, FORTRAN, and BASIC) accepts a
  5415.  different set of symbols, operators, functions, and constants, as explained
  5416.  in Chapter 4, "CodeView Expressions." The resulting expressions can contain
  5417.  the intrinsic functions listed for the FORTRAN and BASIC expression
  5418.  evaluators. They may also contain functions that are part of the executable
  5419.  file. The simplest form of expression is a symbol representing a single
  5420.  variable or routine.
  5421.  
  5422.  ───────────────────────────────────────────────────────────────────────────
  5423.  NOTE
  5424.     FORTRAN subroutines and BASIC subprograms do not return values as
  5425.     functions do. They can be used in expressions, and may be useful for
  5426.     observing side effects. However, the value returned by the expression
  5427.     will be meaningless.
  5428.  ───────────────────────────────────────────────────────────────────────────
  5429.  
  5430.  In addition to displaying values, the Display Expression command can also
  5431.  set values as a side effect. For example, with the C expression evaluator
  5432.  you can increment the variable n by using the expression ++n with the
  5433.  Display Expression command. With the FORTRAN expression evaluator you would
  5434.  use N=N+1, and with the BASIC expression evaluator you would use LET N=N+1.
  5435.  After being incremented, the new value will be displayed.
  5436.  
  5437.  You can specify the format in which the values of expressions are displayed
  5438.  by the Display Expression command. Type a comma after the expression,
  5439.  followed by a CodeView format specifier. The format specifiers used in the
  5440.  CodeView debugger are a subset of those used by the C printf function. They
  5441.  are listed in Table 6.1.
  5442.  
  5443.  Table 6.1  CodeView Format Specifiers
  5444. ╓┌────────────┌──────────────────────────────────┌─────────────┌─────────────╖
  5445.               Output                             Sample        Sample
  5446.  Character    Format                             Expression    Output
  5447.  
  5448.  d            Signed decimal integer             ? 40000,d      40000
  5449.  
  5450.  i            Signed decimal integer             ? 40000,i      40000
  5451.  
  5452.  u           Unsigned decimal integer           ? 40000,u      40000
  5453.  
  5454.  o            Unsigned octal integer             ? 40000,o      116100
  5455.  
  5456.  x or X       Hexadecimal integer                ? 40000,x      9c40
  5457.  
  5458.  f            Signed value in floating-point     ? 3./2.,f      1.500000
  5459.               decimal format with six decimal
  5460.               places
  5461.  
  5462.               Output                             Sample        Sample
  5463.  Character    Format                             Expression    Output
  5464.  
  5465. 
  5466.  e or E      Signed value in scientific-        ? 3./2.,e      1.500000e+000
  5467.               notation format with up to six
  5468.               decimal places (trailing zeros
  5469.               and decimal point are truncated)
  5470.  
  5471.  g or G      Signed value with floating-point   ? 3./2.,g      1.5
  5472.               decimal format (f) or scientific-
  5473.               notation format (g or G),
  5474.               whichever is more compact
  5475.  
  5476.  c            Single character                   ? 65,c         A
  5477.  
  5478.  s           Characters printed up to the       ? "String",s   String
  5479.               first null character
  5480.  
  5481.  
  5482.  If no format specifier is given, single- and double-precision real numbers
  5483.  are displayed as if the format specifier had been given as g. (If you are
  5484.  familiar with the C language, you should note that the n and p format
  5485.  specifiers and the F and H prefixes are not supported by the CodeView
  5486.  debugger, even though they are supported by the C printf function.)
  5487.  
  5488.  The prefix h can be used with the integer format specifiers (d, o, u, x, and
  5489.  X) to specify a two-byte integer. The prefix l can be used with the same
  5490.  types to specify a four-byte integer. For example, the command ?100000,ld
  5491.  produces the output 100000. However, the command ?100000,hd evaluates only
  5492.  the low-order two bytes, producing the output -31072.
  5493.  
  5494.  You can specify individual members of a C structure or BASIC user-defined
  5495.  type, or display the entire structure. Each member of a structure or BASIC
  5496.  user-defined type is displayed, within the limits of the dialog box. (See
  5497.  Section 6.2, "The Graphic Display Command," for information on how to see
  5498.  all the fields of a large structure.)
  5499.  
  5500.  The Display Expression command does not work for programs assembled with
  5501.  Microsoft Macro Assembler Versions 4.0 and earlier because the assembler
  5502.  does not write information to the object file about the type size of each
  5503.  variable. Use the Dump command instead.
  5504.  
  5505.  When calling a FORTRAN subroutine that uses alternate returns, the value of
  5506.  the return labels in the actual parameter list must be 0. For example, the
  5507.  subroutine call CALL PROCESS (I,*10,J,*20,*30) must be called from the
  5508.  debugger as?PROCESS(IARG1,0,IARG2,0,0). Using other values as return labels
  5509.  will cause the error Typeclash in function argument or Unknown symbol.
  5510.  
  5511.  ───────────────────────────────────────────────────────────────────────────
  5512.  NOTE
  5513.     Do not use a type specifier when evaluating strings in FORTRAN  or BASIC.
  5514.     Simply leave off the type specifier, and the expression evaluator will
  5515.     display the string correctly. The s type specifier assumes the C language
  5516.     string format, with which other languages conflict; if you use s, then
  5517.     the debugger will simply display characters at the given address until a
  5518.     null is encountered.
  5519.  ───────────────────────────────────────────────────────────────────────────
  5520.  
  5521.  Mouse
  5522.  
  5523.  The Display Expression command cannot be executed with the mouse.
  5524.  
  5525.  Keyboard
  5526.  
  5527.  The Display Expression command cannot be executed by using a keyboard
  5528.  command.
  5529.  
  5530.  Dialog
  5531.  
  5532.  To display the value of an expression using a dialog command, enter a
  5533.  command line with the following syntax:
  5534.  
  5535.       ? expression[[,format]]
  5536.  
  5537.  The expression is any valid CodeView expression, and the optional format is
  5538.  a CodeView format specifier.
  5539.  
  5540.  The remainder of this section first gives examples that are relevant to all
  5541.  languages and then gives examples specific to C, FORTRAN, and BASIC.
  5542.  
  5543.  If you are debugging code written with the assembler, you will use the C
  5544.  expression evaluator by default. See Section 4.4 for guidelines on how to
  5545.  use the C expression evaluator with assembly code.
  5546.  
  5547.  Examples
  5548.  
  5549.       >? amount
  5550.       500
  5551.       >? amount,x
  5552.       1f4
  5553.       >? amount,o
  5554.       764
  5555.       >
  5556.  
  5557.  The example above displays the value stored in the variable amount, an
  5558.  integer. This value is first displayed in the system radix (in this case,
  5559.  decimal), then in hexadecimal, and then in octal.
  5560.  
  5561.       ? mystruct
  5562.       {c1=123, c2={a=1, b=2}, c3=0x1000:2d34}
  5563.  
  5564.  The example above shows how the CodeView debugger displays a C structure or
  5565.  BASIC user-defined type. Note that nested structures are displayed within an
  5566.  extra set of braces.
  5567.  
  5568.       >? 92,x
  5569.       5c
  5570.       >? 109*(35+2),o
  5571.       7701
  5572.       >? 118,c
  5573.       v
  5574.       >
  5575.  
  5576.  The example above shows how the CodeView debugger can be used as a
  5577.  calculator. You can convert between radixes, calculate the value of constant
  5578.  expressions, or check ASCII equivalences.
  5579.  
  5580.       >? chance,f
  5581.       0.083333
  5582.       >? chance,e
  5583.       8. 333333e-002
  5584.       >? chance,E
  5585.       8.333333E-002
  5586.  
  5587.  The example above shows a double-precision real number, chance, displayed in
  5588.  three formats. The f format always displays six digits of precision. The e
  5589.  format uses scientific notation. Note that the E format yields essentially
  5590.  the same display as e does.
  5591.  
  5592.  The rest of the examples in this section are specific to particular
  5593.  languages.
  5594.  
  5595.  C Examples
  5596.  
  5597.  The following examples assume that a C source file is being debugged and it
  5598.  contains the following declarations:
  5599.  
  5600.       char *text = "Here is a string."
  5601.       int  amount;
  5602.       struct {
  5603.            char name[20];
  5604.            int  id;
  5605.            long class;
  5606.       } student, *pstudent;
  5607.  
  5608.       int square(int);
  5609.  
  5610.  Assume also that the program has been executed where the above variables
  5611.  have been assigned values, and that the C expression evaluator is in use.
  5612.  
  5613.       >? text, X
  5614.       13f3
  5615.       >DA 0x13F3
  5616.       3D83:13F0  Here is a string.
  5617.       >? text,s
  5618.       Here is a string.
  5619.       >
  5620.  
  5621.  The example above shows how to examine strings. One method is to evaluate
  5622.  the variable that points to the string, and then dump the values at that
  5623.  address (the Dump commands are explained in Section 6.4). A more direct
  5624.  method is to use the s type specifier.
  5625.  
  5626.       >? student.id
  5627.       19643
  5628.       >? pstudent->id
  5629.       19643
  5630.       >
  5631.  
  5632.  The example above illustrates how to display the values of members of a
  5633.  structure. The same syntax applies to unions.
  5634.  
  5635.       >? amount
  5636.       500
  5637.       >? ++amount
  5638.       501
  5639.       >? amount=600
  5640.       600
  5641.       >
  5642.  
  5643.  The example above shows how the Display Expression command can be used with
  5644.  the C expression evaluator to change the values of variables.
  5645.  
  5646.       >? square(9)
  5647.       81
  5648.       >
  5649.  
  5650.  The example above shows how functions can be evaluated in expressions. The
  5651.  CodeView debugger executes the function square with an argument of 9, and
  5652.  displays the value returned by the function. Note that you can use symbols
  5653.  as well as constants as function arguments. However, you can only display
  5654.  function values after you have executed into the function main.
  5655.  
  5656.  The C expression evaluator also supports type casts. The equivalent of a
  5657.  type cast in another language is a type-conversion function.
  5658.  
  5659.  FORTRAN Examples
  5660.  
  5661.  The examples below assume that the FORTRAN source file contains the
  5662.  following variable declarations, in which SQUARE is a function:
  5663.  
  5664.              INTEGER*2 SQUARE
  5665.              INTEGER*2 AMOUNT
  5666.              CHARACTER*16 STR
  5667.              STR = 'Here is a string'
  5668.  
  5669.  Assume also that the program has executed to the point where these variables
  5670.  have been assigned values, and that the FORTRAN expression evaluator has
  5671.  been selected.
  5672.  
  5673.       >? STR
  5674.       'Here is a string'
  5675.  
  5676.  The example above shows how to examine strings with the FORTRAN expression
  5677.  evaluator. The s format specifier is not required.
  5678.  
  5679.       ? AMOUNT
  5680.       500
  5681.       >? AMOUNT=AMOUNT+1
  5682.       501
  5683.       >? AMOUNT=600
  5684.       600
  5685.       >? AMOUNT
  5686.       600
  5687.       >
  5688.  
  5689.  The example above shows how the Display Expression command can be used to
  5690.  change values with the FORTRAN expression evaluator.
  5691.  
  5692.       ? SQUARE(9)
  5693.       81
  5694.       >
  5695.  
  5696.  The example above shows how functions can be evaluated in expressions. The
  5697.  CodeView debugger executes the function SQUARE with an argument of 9, and
  5698.  displays the value returned by the function. You can only display the values
  5699.  of functions after you have executed into the main program level.
  5700.  
  5701.  BASIC Examples
  5702.  
  5703.  These examples assume the BASIC source file contains the following
  5704.  statements:
  5705.  
  5706.       amount% = 500
  5707.       str$ = "Here is a string"
  5708.  
  5709.  Assume also that the program has been executed up to these statements and
  5710.  that the BASIC expression evaluator is in use.
  5711.  
  5712.       >? str$
  5713.       Here is a string
  5714.  
  5715.  The first example above shows how to examine strings with the BASIC
  5716.  expression evaluator. The s format specifier should not be used.
  5717.  
  5718.       ? ASC(str$)
  5719.       72
  5720.  
  5721.  The second example demonstrates one of the BASIC intrinsic functions
  5722.  supported by the CodeView debugger, ASC, which returns the ASCII value of
  5723.  the first character in a string.
  5724.  
  5725.       >? amount%
  5726.       500
  5727.       >? LET amount%=amount%+1
  5728.       501
  5729.       >? LET amount%=600
  5730.       600
  5731.       >? amount%
  5732.       600
  5733.       >
  5734.  
  5735.  The example above shows how the Display Expression command can be used to
  5736.  change values with the BASIC expression evaluator. With BASIC, the LET
  5737.  command can only be applied to numeric data, not strings.
  5738.  
  5739.  ───────────────────────────────────────────────────────────────────────────
  5740.  NOTE
  5741.     The BASIC expression evaluator cannot evaluate functions defined in the
  5742.     program, as the C and FORTRAN expression evaluators can.
  5743.  ───────────────────────────────────────────────────────────────────────────
  5744.  
  5745.  Assembly Examples
  5746.  
  5747.  By default, the C expression evaluator is used for debugging assembly
  5748.  modules. However, some C expressions are particularly helpful for debugging
  5749.  assembly code. Some typical examples are presented below.
  5750.  
  5751.       >? BY bx
  5752.       12
  5753.       >
  5754.  
  5755.  The example above displays the first byte at the location pointed to by BX,
  5756.  and is equivalent to the assembly expression BYTE PTR[bx].
  5757.  
  5758.       >? WO bp+8
  5759.       9359
  5760.       >
  5761.  
  5762.  The example above displays the first word at the location pointed to by
  5763.  [bp+8].
  5764.  
  5765.       >? DW si+12
  5766.       Y12555324
  5767.       >
  5768.  
  5769.  The example above displays the first double word at the location pointed to
  5770.  by [si+12].
  5771.  
  5772.       >? (char) var
  5773.       5
  5774.       >? (int) var
  5775.       1005
  5776.       >
  5777.  
  5778.  The last two examples use type casts, which are similar to the assembler PTR
  5779.  operator. The expression (char) var displays the byte at the address of var,
  5780.  in signed format. The expression (int) var displays the word at the same
  5781.  address, also in signed format. You can alter either of these commands to
  5782.  display results in unsigned format simply by using the u format specifier.
  5783.  
  5784.       >? (char) var,u
  5785.  
  5786.       >? (int) var,u
  5787.  
  5788.  
  5789.  6.2  The Graphic Display Command
  5790.  
  5791.  The Graphic Display command (??) is similar to the Examine Symbols command.
  5792.  The Graphic Display command shows the value of any symbol you specify.
  5793.  However, the Graphic Display command is the more efficient means for viewing
  5794.  a multiple-field object such as a structure or a linked list of data.
  5795.  
  5796.  The Graphic Display command lets you browse through related data. For
  5797.  example, both C and BASIC let you define structures inside of other
  5798.  structures. (In BASIC, structures are called "user-defined types.") The
  5799.  Graphic Display command lets you quickly move up and down through layers of
  5800.  structures. The command also works with C pointer variables; with a single
  5801.  mouse click or a few keystrokes, you see the entire structure that a pointer
  5802.  addresses. When you examine a list of structures linked through pointers,
  5803.  the Graphic Display command lets you quickly move back and forth through the
  5804.  list.
  5805.  
  5806.  To resume debugging, you must remove the Graphic Display dialog box.
  5807.  Pressing ESC terminates the dialog box.
  5808.  
  5809.  ───────────────────────────────────────────────────────────────────────────
  5810.  NOTE
  5811.     Throughout the rest of this section, the term "structure" is used to
  5812.     refer to any of the following: a C structure, Pascal record, or BASIC
  5813.     user-defined type.
  5814.  ───────────────────────────────────────────────────────────────────────────
  5815.  
  5816.  This section discusses how to invoke the Graphic Display command and how to
  5817.  browse through data once the Graphic Display dialog box appears. Regardless
  5818.  of how you invoke the command, the same rules apply for browsing through the
  5819.  data.
  5820.  
  5821.  
  5822.  6.2.1  Invoking the Graphic Display Command
  5823.  
  5824.  The Graphic Display command is useful for evaluating a structure or pointer,
  5825.  although you can legally use the command with any variable. To use this
  5826.  command to display the contents of a variable, enter the following:
  5827.  
  5828.       ??symbol, c
  5829.  
  5830.  In the syntax display above, symbol is the name of any recognized variable,
  5831.  the second field is either blank or contains the character c.
  5832.  
  5833.  The second field may contain the character c. This character is a C printf
  5834.  format specifier that causes CodeView to display each byte of a character
  5835.  array in its ASCII form, rather than display its numerical value.
  5836.  
  5837.  As shown in the Figure 6.1 below, structures are represented as three dots
  5838.  enclosed in braces: {...}. Pointers are represented in the standard
  5839.  segment:offset format. The Graphic Display dialog box also displays a title;
  5840.  the title is the name of the variable or member currently displayed.
  5841.  
  5842.  Example
  5843.  
  5844.       ?? graduate, c
  5845.  
  5846.  The example above displays the members of a structure, as shown in Figure
  5847.  6.1.
  5848.  
  5849.  As is the case with the display of local variables, nested structures are
  5850.  represented as three dots enclosed in braces, and pointers are represented
  5851.  in the standardsegment:offset format. Section 6.2.2, "Changing the Display,"
  5852.  explains how to select nested structures and pointers for display.
  5853.  
  5854.       ?? Kount
  5855.  
  5856.  Since Kount is neither a structure nor an array, CodeView responds by
  5857.  displaying a single field as shown in Figure 6.2.
  5858.  
  5859.  To close the Graphic display dialog box and continue debugging, click left
  5860.  outside the dialog box or press ESC.
  5861.  
  5862.  
  5863.  6.2.2  Changing the Display
  5864.  
  5865.  Once the Graphic Display dialog box appears, you change what information is
  5866.  displayed by selecting an individual variable, member, or array element.
  5867.  (However, the command displays array elements only when the current module
  5868.  is a C module.) Making such a selection changes the subject matter of the
  5869.  dialog box; for example, selecting a nested structure moves you one level
  5870.  deeper within the structure. You can use either the mouse or the keyboard to
  5871.  select an item.
  5872.  
  5873.  Changing the Display with the Mouse
  5874.  
  5875.  To select an item with the mouse, simply click the left mouse button on the
  5876.  line where the item appears.
  5877.  
  5878.  CodeView allows you to move backward through displays as well as forward.
  5879.  After you select an item and move to a new display, CodeView remembers the
  5880.  previous state of the dialog box. To move back to the previous display,
  5881.  click the backward arrow just below the dialog box title, or click the right
  5882.  mouse button.
  5883.  
  5884.  To close the dialog box and continue debugging, click the left mouse button
  5885.  while outside the dialog box.
  5886.  
  5887.  Changing the Display with the Keyboard
  5888.  
  5889.  To select an item with the keyboard, move the cursor to the desired item and
  5890.  press ENTER.
  5891.  
  5892.  CodeView allows you to move backward through displays as well as forward.
  5893.  After you select an item and move to a new display, CodeView remembers the
  5894.  previous state of the dialog box. To move back to the previous display,
  5895.  press BACKSPACE.
  5896.  
  5897.  To close the dialog box and continue debugging, press ESC.
  5898.  
  5899.  Effect of Selecting an Item
  5900.  
  5901.  Depending on the item you select, CodeView executes a specific action:
  5902.  
  5903.  Item                        Action
  5904.  
  5905.  Nested structure            The structure is "expanded"; the nested
  5906.                              structure becomes the new subject of the dialog
  5907.                              box. The dialog box displays each member of the
  5908.                              nested structure.
  5909.  
  5910.  Pointer                     The pointer is "dereferenced"; in other words,
  5911.                              CodeView locates the data that the pointer
  5912.                              addresses. This data becomes the new subject of
  5913.                              the dialog box.
  5914.  
  5915.                              The pointer's type determines how the debugger
  5916.                              displays the dereferenced data. The debugger
  5917.                              uses this type information even if the pointer
  5918.                              does not currently address any meaningful data.
  5919.                              If the pointer addresses a structure, CodeView
  5920.                              displays each element.
  5921.  
  5922.  Other items                 CodeView takes no action.
  5923.  
  5924.  No matter how many times you change the display, and no matter what the
  5925.  previous display looked like, all the rules above apply. You can repeat
  5926.  these operations any number of times. For example, given a sufficiently
  5927.  complex structure, you can move down several levels of nested structures,
  5928.  then follow a pointer reference to another variable.
  5929.  
  5930.  
  5931.  6.3  Examine Symbols Command
  5932.  
  5933.  The Examine Symbols command displays the names and addresses and the names
  5934.  of modules defined within a program. You can specify the group you want to
  5935.  examine by module, procedure, or name.
  5936.  
  5937.  Mouse
  5938.  
  5939.  The Examine Symbols command cannot be executed with the mouse.
  5940.  
  5941.  Keyboard
  5942.  
  5943.  The Examine Symbols command cannot be executed with a keyboard command.
  5944.  
  5945.  Dialog
  5946.  
  5947.  To view the addresses of symbols with a dialog command, enter a command line
  5948.  in one of the following formats:
  5949.  
  5950.       XL
  5951.       X*
  5952.       X
  5953.       X? «module!» «routine.» «symbol» «*»
  5954.  
  5955.  in which routine is in a program unit, such as a C function or a BASIC
  5956.  subprogram, capable of having its own local variables.
  5957.  
  5958.  The syntax combinations are listed in more detail below.
  5959.  
  5960. ╓┌───────────────────────────┌───────────────────────────────────────────────╖
  5961.  Syntax                      Display
  5962.  
  5963.  X?module!routine.symbol     The specified symbol in the specified routine in
  5964.                              the specified module.
  5965.  
  5966.  Syntax                      Display
  5967.  
  5968. 
  5969.  X?module!routine.*          All symbols in the specified routine in the
  5970.                              specified module.
  5971.  
  5972.  X?module!symbol             The specified symbol in the specified module
  5973.                              (symbols within routines are not found).
  5974.  
  5975.  X?module!*                  All symbols in the specified module.
  5976.  
  5977.  X?routine.symbol            The specified symbol in the specified routine
  5978.                              (looks for routine first in the current module,
  5979.                              and then in other modules from first to last).
  5980.  
  5981.  X?routine.*                 All symbols in the specified routine (looks for
  5982.                              routine first in the current module, and then in
  5983.                              other modules from first to last).
  5984.  
  5985.  X?symbol                    Looks for the specified symbol in this order:
  5986.  
  5987.  Syntax                      Display
  5988.  
  5989. 
  5990.                              1.  In the current routine.
  5991.                              2.  In the current module.
  5992.                              3.  In other modules, from first to last.
  5993.  
  5994.  X?*                         All symbols in the current routine.
  5995.  
  5996.  XL                          All local variables of the currently executing
  5997.                              routine. This variation of the command uses a
  5998.                              special format as explained below.
  5999.  
  6000.  X*                          All module names (file extensions are added to
  6001.                              these names).
  6002.  
  6003.  X                           All symbolic names in the program, including all
  6004.                              modules and symbols.
  6005.  
  6006.  
  6007.  When you debug an assembly module, you cannot use the routine field; you
  6008.  must use the module field. Therefore, the only versions of this command that
  6009.  work with assembly modules are the following:
  6010.  
  6011.       X?module!*
  6012.       X?module!symbol
  6013.  
  6014.  XL is a special variation of the Examine Symbol command. It lists local
  6015.  variables for the currently executing routine and provides more information
  6016.  than other variations of the command.
  6017.  
  6018.  Whereas most forms of the command display the address, type, and name of
  6019.  each symbol, the XL variation displays the value of each local variable as
  6020.  well. The value of a local variable is displayed in the same format that the
  6021.  Display Expression command would use, assuming no type specifier.
  6022.  
  6023.  The following example shows the use of the XL command when the currently
  6024.  executing routine has many local variables.
  6025.  
  6026.       >XL
  6027.       [BP+0004]   int          argc = 1
  6028.       [BP+0006]   char * *     argv = 0x2f:0x1510
  6029.       [BP-0002]   int          i = 20
  6030.       SI register int          k = 7
  6031.       [BP-0078]   struct cat   item0 = {item1=0, item2=0, dog=0x2f:0x1476}
  6032.       [BP-0070]   struct cow   moo = {c1=11, c2=22, c3=36, c4=16}
  6033.       [BP-0008]   char *       wiz = 0x2f:0x1514
  6034.       [BP-0080]   int          duck = 0
  6035.       DI register int          j = 83
  6036.  
  6037.  In the example above, variables i and j are register variables assigned to
  6038.  the registers SI and DI, respectively. The other variables are located on
  6039.  the stack; XL shows the displacement of each variable from the BP register,
  6040.  which holds the value of the stack pointer (SP) at the time of entry into
  6041.  the procedure.
  6042.  
  6043.  If you have a parameter that is declared as a register in a C program, it
  6044.  will appear twice: on the stack (as an offset from BP) and in the SI or DI
  6045.  register.
  6046.  
  6047.  Note that if you program in assembly, local variables are not recognized by
  6048.  CodeView unless you use the PROC and LOCALS directives provided with MASM
  6049.  Version 5.1 and later.
  6050.  
  6051.  The rest of this section shows examples using the other variations of the
  6052.  Examine Symbols command.
  6053.  
  6054.  C Examples
  6055.  
  6056.  For the following examples, assume that the program being examined is called
  6057.  pi.exe, and that it consists of two modules: pi.c and math.c. The pi.c
  6058.  module is a skeleton consisting only of the main function, whereas the
  6059.  math.c module has several functions.  Assume that the current function is
  6060.  div within the math module.
  6061.  
  6062.       >X*        ;*Example 1
  6063.       PI.OBJ
  6064.       MATH.OBJ
  6065.       chkstk.asm
  6066.       crt0.asm
  6067.       .
  6068.       .
  6069.       .
  6070.       C:\LIB\SLIBC.LIB(xtoa.asm)
  6071.       >
  6072.  
  6073.  Example 1 lists the two user-created modules of the program, as well as the
  6074.  library modules used in the program.
  6075.  
  6076.       >X?*       ;*Example 2
  6077.                 DI        int              b
  6078.                 [BP-0006] int              quotient
  6079.                 SI        int              i
  6080.                 [BP-0002] int              remainder
  6081.                 [BP+0004] int              divisor
  6082.       >
  6083.  
  6084.  Example 2 lists the symbols in the current function (div). Local variables
  6085.  are shown as being stored either in a register (b in register DI) or at a
  6086.  memory location specified as an offset from a register (divisor at location
  6087.  [BP+0004]).
  6088.  
  6089.       >X?pi!*         ;* Example 3
  6090.       3D37:19B2       int       _scratch0     3D37:0A10 char     _p[]
  6091.       3D37:2954 int       _scratch1           3D37:19B4 char     _t[]
  6092.       3D37:2956 int       _scratch2           3D37:19B0 int      _q
  6093.       3A79:0010 int       _main()               3A79:0010 int    main()
  6094.       3D37:19B2 int        scratch0
  6095.       3D37:0A10 char       p[]
  6096.       3D37:2954 int        scratch1
  6097.       3D37:19B4 char       t[]
  6098.       3D37:2956 int        scratch2
  6099.       3D37:19B0 int        q
  6100.       >
  6101.  
  6102.  Example 3 shows all the symbols in the pi.c module.
  6103.  
  6104.       >X?math!div.*   ;*Example 4
  6105.       3A79:0264   int       div()
  6106.                    DI          int              b
  6107.                    [BP-0006]   int              quotient
  6108.                    SI          int              i
  6109.                    [BP-0002]   int              remainder
  6110.                    [BP+0004]   int              divisor
  6111.       >
  6112.  
  6113.  Example 4 shows the symbols in the div function in module math.c. You
  6114.  wouldn't need to specify the module if math.c were the current module, but
  6115.  you would if the current module were pi.c.
  6116.  
  6117.  Variables local to a function are indented under that function.
  6118.  
  6119.       >X?math!arctan.s       ;* Example 5
  6120.       3A79:00FA int              arctan()
  6121.                     [BP+0004] int              s
  6122.       >
  6123.  
  6124.  Example 5 shows one specific variable (s) within the arctan function.
  6125.  
  6126.  FORTRAN Examples
  6127.  
  6128.  For the following examples, assume that the program being examined is called
  6129.  FRUST.EXE, and it consists of four modules: FRUST.FOR, FRUST1.FOR,
  6130.  FRUST2.FOR, and FRUST3.FOR. Assume that the current routine is main within
  6131.  the FRUST.FOR module.
  6132.  
  6133.       >X*
  6134.       FRUST.OBJ
  6135.       FRUST1.OBJ
  6136.       FRUST2.OBJ
  6137.       FRUST3.OBJ
  6138.       fixups.asm
  6139.       crt0.asm
  6140.       .
  6141.       .
  6142.       .
  6143.       txtmode.asm
  6144.       _creat.asm
  6145.  
  6146.  The example above lists the four modules called by the program. The library
  6147.  files called by the program are also listed.
  6148.  
  6149.       >X?T
  6150.                     520D:0DE4 REAL*4    T
  6151.  
  6152.  The example above shows the address of the variable T in the current module.
  6153.  
  6154.       >X?FRUST3!MULTPI.*
  6155.                     4B28:0005 INTEGER*4        MULTPI()
  6156.                     [BP+000A]                  V
  6157.                     [BP+0006]                  X
  6158.                     [BP-0004] INTEGER*4        MULTPI
  6159.  
  6160.  The example above lists the symbols in the function MULTPI, located in
  6161.  module FRUST3. Variables local to the function are indented under the
  6162.  function. You wouldn't need to specify the module if FRUST3 were the current
  6163.  module.
  6164.  
  6165.       >X?FRUST2!SAREA.*
  6166.                     4B15:000E void             SAREA()
  6167.                     [BP+0012]                  R1
  6168.                     [BP+000E]                  R2
  6169.                     [BP+000A]                  H
  6170.                     [BP+0006]                  T
  6171.                     520D:0DEC REAL*4           S12
  6172.                     520D:0DE8 REAL*4           U
  6173.  
  6174.  The example above shows all the symbols in the routine SAREA in the module
  6175.  FRUST2. Because SAREA is a subroutine instead of a function, the word void
  6176.  appears where function return-value types are shown.
  6177.  
  6178.  BASIC Examples
  6179.  
  6180.  For the following examples, assume that the program being examined is called
  6181.  PROG.EXE, and it consists of the following modules: PROG.BAS and SORT.BAS.
  6182.  Assume that the current routine is the main program (which, unlike
  6183.  subprograms, has no name in a BASIC program) and the module SORT.BAS
  6184.  contains two subprograms, SORT and SWITCH.
  6185.  
  6186.       >X*
  6187.       PROG.OBJ
  6188.       SORT.OBJ
  6189.       ftmdata.asm
  6190.       crt0.asm
  6191.       crt0dat.asm
  6192.       .
  6193.       .
  6194.       .
  6195.       xtoa.asm
  6196.  
  6197.  The example above lists the two modules of the program, including PROG.OBJ,
  6198.  which is the main module. The BASIC library files called by the program are
  6199.  also listed.
  6200.  
  6201.       >X?*
  6202.                     5825:17BE integer          A%[array]
  6203.                     5825:1780 single           HOURS!
  6204.                     5825:1784 integer          I%
  6205.  
  6206.  The example above lists the symbols in the current routine, which happens to
  6207.  be the main program. Although the main program has no label and therefore
  6208.  will not show up in a stack trace, it is still an independent routine and
  6209.  has its own local variables. In BASIC, local variables are not put on the
  6210.  stack unless they are subprogram parameters.
  6211.  
  6212.       >X?*SORT!*
  6213.                     572F:0033 integer          SORT()
  6214.                     572F:00E1 integer          SWITCH()
  6215.  
  6216.  The example above lists the routines in the module SORT.OBJ. This form of
  6217.  the Display Symbols command lists routines only, not variables. Note that
  6218.  SORT() and SWITCH() are given with the addresses of the two subprograms by
  6219.  that name.
  6220.  
  6221.       >X?SORT!SWITCH.*
  6222.                     [BP+0008] integer          B%
  6223.                     [BP+0006] integer          C%
  6224.                     5824:1798 integer          TEMP%
  6225.  
  6226.  The example above shows all the symbols in the routine SWITCH, which is in
  6227.  the SORT.OBJ module. Each represents an integer. However, B% and C%
  6228.  represent subprogram parameters that were passed on the stack, whereas
  6229.  
  6230.  TEMP% is a true subprogram variable. Therefore, TEMP% has an absolute
  6231.  address in memory, whereas B% and C% are addressed relative to the stack.
  6232.  (BP points to the value of the stack at the time the routine SWITCH was
  6233.  called.)
  6234.  
  6235.  
  6236.  6.4  Dump Commands
  6237.  
  6238.  The CodeView debugger has several commands for dumping data from memory to
  6239.  the screen (or other output device). The Dump commands are listed below.
  6240.  
  6241.         Command                    Command Name
  6242.  
  6243.         D                    Dump (size is the default type)
  6244.  
  6245.         DB                   Dump Bytes
  6246.  
  6247.         DA                   Dump ASCII
  6248.  
  6249.         DI                   Dump Integers
  6250.  
  6251.         DU                   Dump Unsigned Integers
  6252.  
  6253.         DW                   Dump Words
  6254.  
  6255.         DD                   Dump Double Words
  6256.  
  6257.         DS                   Dump Short Reals
  6258.  
  6259.         DL                   Dump Long Reals
  6260.  
  6261.         DT                   Dump 10-Byte Reals
  6262.  
  6263.  Mouse
  6264.  
  6265.  The Dump commands cannot be executed with the mouse.
  6266.  
  6267.  Keyboard
  6268.  
  6269.  The Dump commands cannot be executed with keyboard commands.
  6270.  
  6271.  Dialog
  6272.  
  6273.  To execute a Dump command with a dialog command, enter a command line with
  6274.  the following syntax:
  6275.  
  6276.       D«type» «address | range»
  6277.  
  6278.  The type is a one-letter specifier that indicates the type of the data to be
  6279.  dumped. The Dump commands expect either a starting address or a range of
  6280.  memory. If the starting address is given, the commands assume a default
  6281.  range (usually
  6282.  
  6283.  determined by the size of the dialog window) starting at address. If range
  6284.  is given, the commands dump from the start to the end of range. The maximum
  6285.  size of range is 32K.
  6286.  
  6287.  If neither address nor range is given, the commands assume the current dump
  6288.  address as the start of the range and the default size associated with the
  6289.  size of the object as the length of the range. The Dump Real commands have a
  6290.  default range size of one real number. The other Dump commands have a
  6291.  default size determined by the size of the dialog window (if you are in
  6292.  window mode), or a default size of 128 bytes otherwise.
  6293.  
  6294.  The current dump address is the byte following the last byte specified in
  6295.  the previous Dump command. If no Dump command has been used during the
  6296.  session, the dump address is the start of the data segment (DS). For
  6297.  example, if you enter the Dump Words command with no argument as the first
  6298.  command of a session, the CodeView debugger displays the first 64 words (128
  6299.  bytes) of data declared in the data segment. If you repeat the same command,
  6300.  the debugger displays the next 64 words following the ones dumped by the
  6301.  first command.
  6302.  
  6303.  ───────────────────────────────────────────────────────────────────────────
  6304.  NOTE
  6305.     If the value in memory cannot be evaluated as a real number, the Dump
  6306.     commands that display real numbers (Dump Short Reals, Dump Long Reals, or
  6307.     Dump 10-Byte Reals) will display a number containing one of the following
  6308.     character sequences: #NAN, #INF, or #IND. NAN (not a number) indicates
  6309.     that the data cannot be evaluated as a real number. INF (infinity)
  6310.     indicates that the data evaluates to infinity. IND (indefinite) indicates
  6311.     that the data evaluates to an indefinite number.
  6312.  ───────────────────────────────────────────────────────────────────────────
  6313.  
  6314.  Sections 6.4.1-6.4.10 discuss the variations of the Dump commands in order
  6315.  of the size of data they display.
  6316.  
  6317.  
  6318.  6.4.1  Dump
  6319.  
  6320.  Syntax
  6321.  
  6322.       D «address | range»
  6323.  
  6324.  The Dump command displays the contents of memory at the specified address or
  6325.  in the specified range of addresses. The command dumps data in the format of
  6326.  the default type. The default type is the last type specified with a Dump,
  6327.  Enter, Watch Memory, or Tracepoint Memory command. If none of these commands
  6328.  has been entered during the session, the default type is bytes.
  6329.  
  6330.  The Dump command displays one or more lines, depending on the address or
  6331.  range specified. Each line displays the address of the first item displayed.
  6332.  The Dump command must be separated by at least one space from any address or
  6333.  range value. For example, to dump memory starting at symbol a, use the
  6334.  command D a, not Da. The second syntax would be interpreted as the Dump
  6335.  ASCII command.
  6336.  
  6337.  
  6338.  6.4.2  Dump Bytes
  6339.  
  6340.  Syntax
  6341.  
  6342.       DB «address | range»
  6343.  
  6344.  The Dump Bytes command displays the hexadecimal and ASCII values of the
  6345.  bytes at the specified address or in the specified range of addresses. The
  6346.  command displays one or more lines, depending on the address or range
  6347.  supplied.
  6348.  
  6349.  Each line displays the address of the first byte in the line, followed by up
  6350.  to 16 hexadecimal byte values. The byte values are immediately followed by
  6351.  the corresponding ASCII values. The hexadecimal values are separated by
  6352.  spaces, except the eighth and ninth values, which are separated by a dash
  6353.  (-). ASCII values are printed without separation. Unprintable ASCII values
  6354.  (less than 32 or greater than 126) are displayed as dots. No more than 16
  6355.  hexadecimal values are displayed in a line. The command displays values and
  6356.  characters until the end of the range or, if no range is given, until the
  6357.  first 128 bytes have been displayed.
  6358.  
  6359.  Example
  6360.  
  6361.       >DB 0 36
  6362.       3D5E:0000 53 6F 6D 65 20 6C 65 74-74 65 72 73 20 61 6E 64 Someletters an
  6363.       3D5E:0010 20 6E 75 6D 62 65 72 73-3A 00 10 EA 89 FC FF EF  numbers:.....
  6364.       3D5E:0020 00 F0 00 CA E4         -                         .....
  6365.       >
  6366.  
  6367.  The example above displays the byte values from DS:0 to DS:36 (36 decimal is
  6368.  equivalent to 24 hexadecimal). The data segment is assumed if no segment is
  6369.  given. ASCII characters are shown on the right.
  6370.  
  6371.  
  6372.  6.4.3  Dump ASCII
  6373.  
  6374.  Syntax
  6375.  
  6376.       DA «address | range»
  6377.  
  6378.  The Dump ASCII command displays the ASCII characters at a specified address
  6379.  or in a specified range of addresses. The command displays one or more lines
  6380.  of characters, depending on the address or range specified.
  6381.  
  6382.  If no ending address is specified, the command dumps either 128 bytes or all
  6383.  bytes preceding the first null byte, whichever comes first. Up to 64
  6384.  characters per line are displayed. Unprintable characters, such as carriage
  6385.  returns and line feeds, are displayed as dots. ASCII characters less than 32
  6386.  and greater than 126 in number are unprintable.
  6387.  
  6388.  Examples
  6389.  
  6390.       >DA 0
  6391.       3D7C:0000 Some letters and numbers:
  6392.       >
  6393.  
  6394.  The example above displays the ASCII values of the bytes starting at DS:0.
  6395.  Since no ending address is given, values are displayed up to the first null
  6396.  byte.
  6397.  
  6398.       >DA 0 36
  6399.       3D7C:0000  Some letters and numbers:...........
  6400.       >
  6401.  
  6402.  In the example above, an ending address is given, so that the characters
  6403.  from DS:0 to DS:36 (24 hexadecimal) are shown. Unprintable characters are
  6404.  shown as dots.
  6405.  
  6406.  
  6407.  6.4.4  Dump Integers
  6408.  
  6409.  Syntax
  6410.  
  6411.       DI «address | range»
  6412.  
  6413.  The Dump Integers command displays the signed decimal values of the words
  6414.  (two-byte values) starting at address or in the specified range of
  6415.  addresses. The command displays one or more lines, depending on the address
  6416.  or range specified. Each line displays the address of the first integer in
  6417.  the line, followed by up to eight signed decimal words. The values are
  6418.  separated by spaces. The command displays values until the end of the range
  6419.  or until the first 64 two-byte integers have been displayed, whichever comes
  6420.  first.
  6421.  
  6422.  ───────────────────────────────────────────────────────────────────────────
  6423.  NOTE
  6424.     In this manual an integer is considered a two-byte value since the
  6425.     CodeView debugger assumes that integer size. Note that a default FORTRAN
  6426.     integer is a four-byte value.
  6427.  ───────────────────────────────────────────────────────────────────────────
  6428.  
  6429.  Example
  6430.  
  6431.       >DI 0 36
  6432.       3D5E:0000   28499  25965  27680  29797  25972  29554  24864  25710
  6433.       3D5E:0010   28192  28021  25954  29554     58  -5616   -887  -4097
  6434.       3D5E:0020   -4096 -13824   2532
  6435.       >
  6436.  
  6437.  The example above displays the byte values from DS:0 to DS:36 (24
  6438.  hexadecimal). Compare the signed decimal numbers at the end of this dump
  6439.  with the same values shown as unsigned integers in Section 6.4.5 below.
  6440.  
  6441.  
  6442.  6.4.5  Dump Unsigned Integers
  6443.  
  6444.  Syntax
  6445.  
  6446.       DU «address | range»
  6447.  
  6448.  The Dump Unsigned Integers command displays the unsigned decimal values of
  6449.  the words (two-byte values) starting at address or in the specified range of
  6450.  addresses. The command displays one or more lines, depending on the address
  6451.  or range specified. Each line displays the address of the first unsigned
  6452.  integer in the line, followed by up to eight decimal words. The values are
  6453.  separated by spaces. The command displays values until the end of the range
  6454.  or until the first 64 unsigned integers have been displayed, whichever comes
  6455.  first.
  6456.  
  6457.  Example
  6458.  
  6459.       >DU 0 36
  6460.       3D5E:0000   28499  25965  27680  29797  25972  29554  24864  25710
  6461.       3D5E:0010   28192  28021  25954  29554     58  59920  64649  61439
  6462.       3D5E:0020   61440  51712   2532
  6463.       >
  6464.  
  6465.  The example above displays the byte values from DS:0 to DS:36 (24
  6466.  hexadecimal). Compare the unsigned decimal numbers at the end of this dump
  6467.  with the same values shown as signed integers in Section 6.4.4 above.
  6468.  
  6469.  
  6470.  6.4.6  Dump Words
  6471.  
  6472.  Syntax
  6473.  
  6474.       DW «address | range»
  6475.  
  6476.  The Dump Words command displays the hexadecimal values of the words
  6477.  (two-byte values) starting at address or in the specified range of
  6478.  addresses. The command displays one or more lines, depending on the address
  6479.  or range specified. Each line displays the address of the first word in the
  6480.  line, followed by up to eight hexadecimal words. The hexadecimal values are
  6481.  separated by spaces. The command displays values until the end of the range
  6482.  or until the first 64 words have been displayed, whichever comes first.
  6483.  
  6484.  Example
  6485.  
  6486.       >DW 0 36
  6487.       3D5E:0000  6F53 656D 6C20 7465 6574 7372 6120 646E
  6488.       3D5E:0010  6E20 6D75 6562 7372 003A EA10 FC89 EFFF
  6489.       3D5E:0020  F000 CA00 09E4
  6490.       >
  6491.  
  6492.  The example above displays the word values from DS:0 to DS:36 (24
  6493.  hexadecimal). No more than eight values per line are displayed.
  6494.  
  6495.  
  6496.  6.4.7  Dump Double Words
  6497.  
  6498.  Syntax
  6499.  
  6500.       DD «address | range»
  6501.  
  6502.  The Dump Double Words command displays the hexadecimal values of the double
  6503.  words (four-byte values) starting at address or in the specified range of
  6504.  addresses.
  6505.  
  6506.  The command displays one or more lines, depending on the address or range
  6507.  specified. Each line displays the address of the first double word in the
  6508.  line, followed by up to four hexadecimal double-word values. The words of
  6509.  each double word are separated by a colon. The values are separated by
  6510.  spaces. The command displays values until the end of the range or until the
  6511.  first 32 double words have been displayed, whichever comes first.
  6512.  
  6513.  Example
  6514.  
  6515.       >DD 0 36
  6516.       3D5E:0000  656D:6F53 7465:6C20 7372:6574 646E:6120
  6517.       3D5E:0010  6D75:6E20 7372:6562 EA10:003A EFFF:FC89
  6518.       3D5E:0020  CA00:F000 6F73:09E4
  6519.       >
  6520.  
  6521.  The example above displays the double-word values from DS:0 to DS:36 (24
  6522.  hexadecimal). No more than four double-word values per line are displayed.
  6523.  
  6524.  
  6525.  6.4.8  Dump Short Reals
  6526.  
  6527.  Syntax
  6528.  
  6529.       DS «address | range»
  6530.  
  6531.  The Dump Short Reals command displays the hexadecimal and decimal values of
  6532.  the short (four-byte) floating-point numbers at address or in the specified
  6533.  range of addresses.
  6534.  
  6535.  The command displays one or more lines, depending on the address or range
  6536.  specified. Each line displays the address of the floating-point number in
  6537.  the first column. Next, the hexadecimal values of the bytes in the number
  6538.  are shown, followed by the decimal value of the number. The hexadecimal
  6539.  values are separated by spaces.
  6540.  
  6541.  The decimal value has the following form:
  6542.  
  6543.       «-»digit.digitsE{+ | -}exponent
  6544.  
  6545.  If the number is negative, it will have a minus sign; positive numbers have
  6546.  no sign. The first digit of the number is followed by a decimal point. Six
  6547.  decimal places are shown following the decimal point. The letter E follows
  6548.  the decimal digits and marks the start of a three-digit signed exponent.
  6549.  
  6550.  The command displays at least one value. If a range is specified, all values
  6551.  in the range are displayed.
  6552.  
  6553.  Example
  6554.  
  6555.       >DS SPI
  6556.       5E68:0100  DB 0F 49 40  3.141593E+000
  6557.       >
  6558.  
  6559.  The example above displays the short-real floating-point number at the
  6560.  address of the variable SPI. Only one value is displayed per line.
  6561.  
  6562.  
  6563.  6.4.9  Dump Long Reals
  6564.  
  6565.  Syntax
  6566.  
  6567.       DL «address | range»
  6568.  
  6569.  The Dump Long Reals command displays the hexadecimal and decimal values of
  6570.  the long (eight-byte) floating-point numbers at the specified address or in
  6571.  the specified range of addresses.
  6572.  
  6573.  The command displays one or more lines, depending on the address or range
  6574.  specified. Each line displays the address of the floating-point number in
  6575.  the first column. Next, the hexadecimal values of the bytes in the number
  6576.  are shown, followed by the decimal value of the number. The hexadecimal
  6577.  values are separated by spaces.
  6578.  
  6579.  The decimal value has the following form:
  6580.  
  6581.       «-»digit.digitsE{+ | -}exponent
  6582.  
  6583.  If the number is negative, it will have a minus sign; positive numbers have
  6584.  no sign. The first digit of the number is followed by a decimal point. Six
  6585.  decimal places are shown following the decimal point. The letter E follows
  6586.  the decimal digits and marks the start of a three-digit signed exponent.
  6587.  
  6588.  The command displays at least one value. If a range is specified, all values
  6589.  in the range are displayed.
  6590.  
  6591.  Example
  6592.  
  6593.       >DL LPI
  6594.       5E68:0200  11 2D 44 54 FB 21 09 40  3.141593E+000
  6595.       >
  6596.  
  6597.  The example above displays the long-real floating-point number at the
  6598.  address of the variable LPI. Only one value per line is displayed.
  6599.  
  6600.  
  6601.  6.4.10  Dump 10-Byte Reals
  6602.  
  6603.  Syntax
  6604.  
  6605.       DT «address | range»
  6606.  
  6607.  The Dump 10-Byte Reals command displays the hexadecimal and decimal values
  6608.  of the 10-byte floating-point numbers at the specified address or in the
  6609.  specified range of addresses.
  6610.  
  6611.  The command displays one or more lines, depending on the address or range
  6612.  specified. Each line displays the address of the floating-point number in
  6613.  the first column. Next, the hexadecimal values of the bytes in the number
  6614.  are shown, followed by the decimal value of the number. The hexadecimal
  6615.  values are separated by spaces.
  6616.  
  6617.  The decimal value has the following form:
  6618.  
  6619.       «-»digit.digitsE{+ | -}exponent
  6620.  
  6621.  If the number is negative, it will have a minus sign; positive numbers have
  6622.  no sign. The first digit of the number is followed by a decimal point. Six
  6623.  decimal places are shown following the decimal point. The letter E follows
  6624.  the decimal digits and marks the start of a three-digit signed exponent.
  6625.  
  6626.  The command displays at least one value. If a range is specified, all values
  6627.  in the range are displayed.
  6628.  
  6629.  Example
  6630.  
  6631.       >DT TPI
  6632.       5E68:0300  DE 87 68 21 A2 DA 0F C9 00 40  3.141593E+000
  6633.       >
  6634.  
  6635.  The example above displays the 10-byte floating-point number at the address
  6636.  of the variable TPI. Only one number per line is displayed.
  6637.  
  6638.  
  6639.  6.5  Compare Memory Command
  6640.  
  6641.  The Compare Memory command provides a convenient way for comparing two
  6642.  blocks of memory, specified by absolute addresses. This command is primarily
  6643.  of interest to programmers using assembly mode; however, it can be useful to
  6644.  anyone who wants to compare two large areas of data, such as arrays.
  6645.  
  6646.  Mouse
  6647.  
  6648.  The Compare Memory command cannot be executed with the mouse.
  6649.  
  6650.  Keyboard
  6651.  
  6652.  The Compare Memory command cannot be executed with a keyboard command.
  6653.  
  6654.  Dialog
  6655.  
  6656.  To compare two blocks of memory, enter a command line with the following
  6657.  syntax:
  6658.  
  6659.       C range address
  6660.  
  6661.  The bytes in the memory locations specified by range are compared with the
  6662.  corresponding bytes in the memory locations beginning at address. If one or
  6663.  more pairs of corresponding bytes do not match, each pair of mismatched
  6664.  bytes is displayed.
  6665.  
  6666.  Examples
  6667.  
  6668.       >C 100 01FF 300     ;* hexadecimal radix assumed
  6669.       39BB:0102 0A 00 39BB:0302
  6670.       39BB:0108 0A 01 39BB:0308
  6671.       >
  6672.  
  6673.  The first example (in which hexadecimal is assumed to be the default radix)
  6674.  compares the block of memory from 100 to 1FF with the block of memory from
  6675.  300 to 3FF. It indicates that the third and ninth bytes differ in the two
  6676.  areas of memory.
  6677.  
  6678.       >C arr1(1) L 100  arr2(1)  ;* BASIC/FORTRAN notation used
  6679.       >
  6680.  
  6681.  The second example compares the 100 bytes starting at the address of
  6682.  arr1(1), with the 100 bytes starting at address of arr2(1). The CodeView
  6683.  debugger produces no output in response, so this indicates that the first
  6684.  100 bytes of each array are identical. (In C language, this example would be
  6685.  entered as Carr1[0] L 100 arr2[0].)
  6686.  
  6687.  ───────────────────────────────────────────────────────────────────────────
  6688.  NOTE
  6689.     You can enter the Compare Memory command using any radix you like;
  6690.     however, any output will still be in hexadecimal format.
  6691.  ───────────────────────────────────────────────────────────────────────────
  6692.  
  6693.  
  6694.  6.6  Search Memory Command
  6695.  
  6696.  The Search Memory command (not to be confused with the Search command
  6697.  discussed in Section 11.5) scans a specified area of memory, looking for
  6698.  specific byte values. It is primarily of interest to programmers using
  6699.  assembly mode and to users testing for the presence of specific values
  6700.  within a range of data.
  6701.  
  6702.  Mouse
  6703.  
  6704.  The Search Memory command cannot be executed with the mouse.
  6705.  
  6706.  Keyboard
  6707.  
  6708.  The Search Memory command cannot be executed with a keyboard command.
  6709.  
  6710.  Dialog
  6711.  
  6712.  To search a block of memory, enter the Search Memory command with the
  6713.  following syntax:
  6714.  
  6715.       S range list
  6716.  
  6717.  The debugger will search the specified range of memory locations for the
  6718.  byte values specified in the list. If bytes with the specified values are
  6719.  found, the debugger displays the addresses of each occurrence of bytes in
  6720.  the list.
  6721.  
  6722.  The list can have any number of bytes. Each byte value must be separated by
  6723.  a space or comma, unless the list is an ASCII string. If the list contains
  6724.  more than one byte, the Search Memory command looks for a series of bytes
  6725.  that precisely match the order and value of bytes in list. If found, the
  6726.  beginning address of each such series is displayed.
  6727.  
  6728.  Examples
  6729.  
  6730.       >S buffer L 1500 "error"
  6731.       2BBA:0404
  6732.       2BBA:05E3
  6733.       2BBA:0604
  6734.       >
  6735.  
  6736.  The first example displays the address of each memory location containing
  6737.  the string error. The command searches the first 1500 bytes at the address
  6738.  specified by buffer. The string was found at the three addresses displayed
  6739.  by the CodeView debugger.
  6740.  
  6741.       >S DS:100 200 0A   ;* hexadecimal radix assumed
  6742.       3CBA:0132
  6743.       3CBA:01C2
  6744.       >
  6745.  
  6746.  The second example displays the address of each memory location that
  6747.  contains the byte value 0A in the range DS:0100 to DS:0200 (hexadecimal).
  6748.  The value was found at two addresses.
  6749.  
  6750.  
  6751.  6.7  Port Input Command
  6752.  
  6753.  The Port Input command reads and displays a byte from a specified hardware
  6754.  port. It is primarily of interest to assembly-language programmers writing
  6755.  hardware-specific programs.
  6756.  
  6757.  Mouse
  6758.  
  6759.  The Port Input command cannot be executed with the mouse.
  6760.  
  6761.  Keyboard
  6762.  
  6763.  The Port Input command cannot be executed with a keyboard command.
  6764.  
  6765.  Dialog
  6766.  
  6767.  The Port Input command is executed with the following syntax:
  6768.  
  6769.       I port
  6770.  
  6771.  The byte is read and displayed from the specified port, which can be any
  6772.  16-bit address.
  6773.  
  6774.  Examples
  6775.  
  6776.       >I 2f8   ;* hexadecimal radix assumed
  6777.       E8
  6778.       >
  6779.  
  6780.  The preceding example reads input port, number 2F8, and displays the result,
  6781.  E8. You may enter the port address using any radix you want, but the result
  6782.  will always be displayed in current radix.
  6783.  
  6784.  The Port Input command is often used in conjunction with the Port Output
  6785.  command, which is described in Section 10.5.
  6786.  
  6787.  
  6788.  6.8  Register Command
  6789.  
  6790.  The Register command has two functions. It displays the contents of the
  6791.  central processing unit (CPU) registers. It can also change the values of
  6792.  the registers. The display features of the Register command are explained
  6793.  here. The modification features of the command are explained in Chapter 10,
  6794.  "Modifying Code or Data."
  6795.  
  6796.  Mouse
  6797.  
  6798.  To display the registers with the mouse, point to View on the menu bar,
  6799.  press a mouse button and drag the highlight down to the Registers selection,
  6800.  then release the button. The register window will appear on the right side
  6801.  of the screen. If the register window is already on the screen, the same
  6802.  command removes it.
  6803.  
  6804.  Keyboard
  6805.  
  6806.  To display the registers using a keyboard command in window mode, press F2.
  6807.  The register window will appear on the right side of the screen. If the
  6808.  register window is already on the screen, the same command will remove it.
  6809.  
  6810.  In sequential mode, the F2 key will display the current status of the
  6811.  registers. (This produces the same effect as entering the Register dialog
  6812.  command with no argument.)
  6813.  
  6814.  Dialog
  6815.  
  6816.  To display the registers in the dialog window (or sequentially in sequential
  6817.  mode), enter a command line with the following syntax:
  6818.  
  6819.       R
  6820.  
  6821.  The current values of all registers and flags are displayed. The instruction
  6822.  at the address pointed to by the current CS and IP register values is also
  6823.  shown. (The Register command can also be given with arguments, but only when
  6824.  used to modify registers, as explained in Chapter 10, "Modifying Code or
  6825.  Data.")
  6826.  
  6827.  If the display mode is source (S+) or mixed (S&) (see Section 9.1, "Set
  6828.  Mode Command," for more information), the current source line is also
  6829.  displayed by the Register command. If an operand of the instruction contains
  6830.  memory expressions or immediate data, the CodeView debugger will evaluate
  6831.  operands and show the value to the right of the instruction. This value is
  6832.  referred to as the "effective address," and is also displayed at the bottom
  6833.  of the register window. If the CS and IP registers are currently at a
  6834.  breakpoint location, the register display will indicate the breakpoint
  6835.  number.
  6836.  
  6837.  In sequential mode, the Trace (T), Program Step (P), and Go (G) commands
  6838.  show registers in the same format as the Register command.
  6839.  
  6840.  Examples
  6841.  
  6842.       >S&
  6843.       mixed
  6844.       >R
  6845.       AX=0005  BX=299E  CX=0000  DX=0000  SP=3800  BP=380E  SI=0070  DI=40D1
  6846.       DS=5067  ES=5067  SS=5067  CS=4684  IP=014F  NV UP EI PL NZ NA PO NC
  6847.       35:                           VARIAN = (N*SUMXSQ-SUMX**2)/(N-1)
  6848.       4684:014F 8B5E06      MOV        BX,Word Ptr [BP+06]     ;BR1  SS:3814=2
  6849.       >
  6850.  
  6851.  The example above displays all register and flag values, as well as the
  6852.  instruction at the address pointed to by the CS and IP registers. Because
  6853.  the mode has been set to mixed (S&), the current source line is also shown.
  6854.  The example is from a FORTRAN program, but applies equally well to BASIC and
  6855.  C programs.
  6856.  
  6857.       >S-
  6858.       assembly
  6859.       >R
  6860.       AX=0005  BX=299E  CX=0000  DX=0000  SP=3800  BP=380E  SI=0070  DI=40D1
  6861.       DS=5067  ES=5067  SS=5067  CS=4684  IP=014F  NV UP EI PL NZ NA PO NC
  6862.       4684:014F 8B5E06       MOV     BX,Word Ptr [BP+06]     ;BR1  SS:3814=299
  6863.       >
  6864.  
  6865.  In the example above, the display mode is set to assembly (S-), so no source
  6866.  line is shown. Note the breakpoint number at the right of the last line
  6867.  indicating that the current address is at Breakpoint 1.
  6868.  
  6869.  
  6870.  6.9  8087 Command
  6871.  
  6872.  The 8087 command dumps the contents of the 8087 registers. If you do not
  6873.  have an 8087, 80287, or 80387 coprocessor chip on your system, this command
  6874.  will dump the contents of the pseudoregisters created by the compiler's
  6875.  emulator routines. This command is useful only if you have an 8087, 80287,
  6876.  or 80387 chip installed or if your executable file includes math routines
  6877.  from a Microsoft 8087-emulator library.
  6878.  
  6879.  ───────────────────────────────────────────────────────────────────────────
  6880.  NOTE
  6881.     This section does not attempt to explain how the registers of the Intel
  6882.     8087 and 80287 processors are organized or how they work. In order to
  6883.     interpret the command output, you must learn about the chip from an Intel
  6884.     reference manual or other book on the subject. Since the Microsoft
  6885.     emulator routines mimic the behavior of the 8087 coprocessor, these
  6886.     references will apply to emulator routines as well as to the chips
  6887.     themselves.
  6888.  ───────────────────────────────────────────────────────────────────────────
  6889.  
  6890.  Mouse
  6891.  
  6892.  The 8087 command cannot be executed with the mouse.
  6893.  
  6894.  Keyboard
  6895.  
  6896.  The 8087 command cannot be executed with a keyboard command.
  6897.  
  6898.  Dialog
  6899.  
  6900.  To display the status of the 8087 or 80287 chip (or floating-point emulator
  6901.  routines) with a dialog command, enter a command line with the following
  6902.  syntax:
  6903.  
  6904.       7
  6905.  
  6906.  The current status of the chip is displayed when you enter the command. In
  6907.  window mode, the output is to the dialog window. If you do not have an 8087
  6908.  or 80287 chip and are not linking to an emulator library, the debugger will
  6909.  report the error message Floating point not loaded. CodeView reports this
  6910.  message each time you give the 7 command, unless a floating-point
  6911.  instruction has been executed.
  6912.  
  6913.  The following example shows a display for a machine that actually has an
  6914.  8087 or 80287 chip. The example at the end of this section shows the same
  6915.  display for a machine using an emulator library instead of an actual math
  6916.  coprocessor.
  6917.  
  6918.  8087 Example
  6919.  
  6920.       >7
  6921.       cControl 037F  (Projective closure, Round nearest, 64-bit precision)
  6922.               iem=0 pm=1 um=1 om=1 zm=1 dm=1 im=1
  6923.       cStatus  6004  cond=1000 top=4 pe=0 ue=0 oe=0 ze=1 de=0 ie=0
  6924.       Tag     A1FF  instruction=59380  operand=59360  opcode=D9EE
  6925.       Stack         Exp  Mantissa           Value
  6926.       cST(3) special 7FFF 8000000000000000 = + Infinity
  6927.       cST(2) special 7FFF 0101010101010101 = + Not a Number
  6928.       cST(1) valid   4000 C90FDAA22168C235 = +3.141592265110390E+000
  6929.       cST(0) zero    0000 0000000000000000 = +0.000000000000000E+000
  6930.       >
  6931.  
  6932.  In the example above, the first line of the dump shows the current closure
  6933.  method, rounding method, and the precision. The number 037F is the
  6934.  hexadecimal value in the control register. The rest of the line interprets
  6935.  the bits of the number. The closure method can be either projective (as in
  6936.  the example) or affine. The rounding method can be either rounding to the
  6937.  nearest even number (as in the example), rounding down, rounding up, or
  6938.  using the chop method of rounding (truncating toward zero). The precision
  6939.  may be 64 bits (as in the example), 53 bits, or 24 bits.
  6940.  
  6941.  The second line of the display indicates whether each exception mask bit is
  6942.  set or cleared. The masks are interrupt-enable mask (iem), precision mask
  6943.  (pm), underflow mask (um), overflow mask (om), zero-divide mask (zm),
  6944.  denormalized-operand mask (dm), and invalid-operation mask (im).
  6945.  
  6946.  The third line of the display shows the hexadecimal value of the status
  6947.  register ( 6004 in the example), and then interprets the bits of the
  6948.  register. The condition code (cond) in the example is the binary number
  6949.  1000. The top of the stack (top) is register 4 (shown in decimal). The
  6950.  other bits shown are precision exception (pe), underflow exception (ue),
  6951.  overflow exception (oe), zero-divide exception (ze), denormalized-operand
  6952.  exception (de), and invalid-operation exception (ie).
  6953.  
  6954.  The fourth line of the display first shows the 20-bit hexadecimal address
  6955.  value of the tag register (A1FF in the example). It then gives the
  6956.  hexadecimal offsets of the instruction (59380), the operand (59360), and
  6957.  the operation code, or opcode, (D9EE).
  6958.  
  6959.  The fifth line is a heading for the subsequent lines that contain the
  6960.  contents of each 8087 or 80287 stack register. The registers in the example
  6961.  contain four types of numbers that may be held in these registers. Starting
  6962.  from the bottom, register 0 contains zero. Register 1 contains a valid real
  6963.  number. Its exponent (in hexadecimal) is 4000 and its mantissa is
  6964.  C90FDAA22168C235. The number is shown in scientific notation in the
  6965.  rightmost column. Register 2 contains a value that cannot be interpreted as
  6966.  a number, and register 3 contains infinity.
  6967.  
  6968.  The c that precedes Control, Status, and each of the ST listings indicates
  6969.  that an actual math-coprocessor chip is in use. If emulator routines were in
  6970.  use instead of a chip, each c prefix would be replaced by e, as in the next
  6971.  example.
  6972.  
  6973.  Floating-Point Emulator Example
  6974.  
  6975.       >7
  6976.       eControl 037F  (Projective closure, Round nearest, 64-bit precision)
  6977.                               iem=0 pm=1 um=1 om=1 zm=1 dm=1 im=1
  6978.       eStatus  6004  cond=1000 top=4 pe=0 ue=0 oe=0 ze=1 de=0 ie=0
  6979.       Tag     A1FF  instruction=59380  operand=59360  opcode=D9EE
  6980.       Stack         Exp  Mantissa           Value
  6981.       eST(3) special 7FFF 8000000000000000 = + Infinity
  6982.       eST(2) special 7FFF 0101010101010101 = + Not a Number
  6983.       eST(1) valid   4000 C90FDAA22168C235 = +3.141592265110390E+000
  6984.       eST(0) zero    0000 0000000000000000 = +0.000000000000000E+000
  6985.       >
  6986.  
  6987.  Note the e at the beginning of the first, third, sixth, seventh, eighth, and
  6988.  ninth lines. Aside from this replacement of the c prefix by e, the emulator
  6989.  display is the same as the corresponding display for an 8087 chip.
  6990.  
  6991.  
  6992.  Chapter 7  Managing Breakpoints
  6993.  ───────────────────────────────────────────────────────────────────────────
  6994.  
  6995.  The CodeView debugger enables you to control program execution by setting
  6996.  breakpoints. A breakpoint is an address that stops program execution each
  6997.  time the address is encountered. By setting breakpoints at key addresses in
  6998.  your program, you can "freeze" program execution and examine the status of
  6999.  memory or expressions at that point.
  7000.  
  7001.  The commands listed below control breakpoints:
  7002.  
  7003.  Command                     Action
  7004.  
  7005.  Breakpoint Set (BP)         Sets a breakpoint and, optionally, a pass count
  7006.                              and break commands
  7007.  
  7008.  Breakpoint Clear (BC)       Clears one or more breakpoints
  7009.  
  7010.  Breakpoint Disable (BD)     Disables one or more breakpoints
  7011.  
  7012.  Breakpoint Enable (BE)      Enables one or more breakpoints
  7013.  
  7014.  Breakpoint List (BL)        Lists all breakpoints
  7015.  
  7016.  In addition to these commands, the Watchpoint (WP) and Tracepoint (TP)
  7017.  commands can be used to set conditional breakpoints (see Chapter 8,
  7018.  "Managing Watch Statements," for information on these two commands).
  7019.  
  7020.  
  7021.  7.1  Breakpoint Set Command
  7022.  
  7023.  The Breakpoint Set command (BP) creates a breakpoint at a specified address.
  7024.  Any time a breakpoint is encountered during program execution, the program
  7025.  halts and waits for a new command.
  7026.  
  7027.  The CodeView debugger allows up to 20 breakpoints (0 through 19). Each new
  7028.  breakpoint is assigned to the next available number. Breakpoints remain in
  7029.  memory until you delete them or until you quit the debugger. They are not
  7030.  canceled when you restart the program. Because breakpoints are not
  7031.  automatically canceled, you are able to set up a complicated series of
  7032.  breakpoints, then execute through the program several times without
  7033.  resetting.
  7034.  
  7035.  If you try to set a breakpoint at a comment line or other source line that
  7036.  does not correspond to code, the CodeView debugger displays the following
  7037.  message:
  7038.  
  7039.       No code at this line number
  7040.  
  7041.  Mouse
  7042.  
  7043.  To set a breakpoint with the mouse, point to the source line or instruction
  7044.  where you want to set the breakpoint and then click the left button. The
  7045.  line will be displayed in high-intensity text and will remain so until you
  7046.  remove or disable the breakpoint.
  7047.  
  7048.  Keyboard
  7049.  
  7050.  To set a breakpoint with a keyboard command in window mode, move the cursor
  7051.  to the source line or instruction where you want to set a breakpoint. You
  7052.  may have to press F6 to move the cursor to the display window. When the
  7053.  cursor is on the appropriate source line, press F9. The line will be
  7054.  displayed in high-intensity text and will remain so until you remove or
  7055.  disable the breakpoint.
  7056.  
  7057.  In sequential mode, the F9 key can be used to set a breakpoint at the
  7058.  current location. You must use the dialog version of the command to set a
  7059.  breakpoint at any other location.
  7060.  
  7061.  Dialog
  7062.  
  7063.  To set a breakpoint using a dialog command, enter a command line with the
  7064.  following syntax:
  7065.  
  7066.       BP «address «passcount» «"commands"»»
  7067.  
  7068.  If no address is given, a breakpoint is created on the current source line
  7069.  in source mode or on the current instruction in assembly mode. You can
  7070.  specify the address in the segment:offset format or as a source line, a
  7071.  routine name, or a label. If you give an offset address, the code segment is
  7072.  assumed.
  7073.  
  7074.  The dialog version of the command is more powerful than the mouse or
  7075.  keyboard version in that it allows you to give a passcount and a string of
  7076.  commands.
  7077.  
  7078.  The passcount specifies the first time the breakpoint is to be taken. For
  7079.  example, if the pass count is 5, the breakpoint will be ignored the first
  7080.  four times it is encountered, and taken the fifth time. Thereafter, the
  7081.  breakpoint is always taken.
  7082.  
  7083.  The commands are a list of dialog commands enclosed in quotation marks (" ")
  7084.  and separated by semicolons (;). For example, if you specify the commands as
  7085.  "? code;T", the CodeView debugger will automatically display the value of
  7086.  the variable code and then execute the Trace command each time the
  7087.  breakpoint is encountered. The Trace and Display Expression commands are
  7088.  described in Chapter 5, "Executing Code," and Chapter 6, "Examining Data an
  7089.  Expressions," respectively.
  7090.  
  7091.  In window mode, a breakpoint entered with a dialog command has exactly the
  7092.  same effect as one created with a window command. The source line or
  7093.  instruction corresponding to the breakpoint location is shown in
  7094.  high-intensity text.
  7095.  
  7096.  In sequential mode, information about the current instruction will be
  7097.  displayed each time you execute to a breakpoint. The register values, the
  7098.  current instruction, and the source line may be shown, depending on the
  7099.  display mode. See Chapter 9, "Examining Code," for more information about
  7100.  display modes.
  7101.  
  7102.  When a breakpoint address is shown in the assembly-language format, the
  7103.  breakpoint number will be shown as a comment to the right of the
  7104.  instruction. This comment appears even if the breakpoint is disabled (but
  7105.  not if it is deleted).
  7106.  
  7107.  Examples
  7108.  
  7109.       >BP .19 10
  7110.       >
  7111.  
  7112.  The example above creates a breakpoint at line 19 of the current source file
  7113.  (or if there is no executable statement at line 19, at the first executable
  7114.  statement after line 19). The breakpoint is passed over nine times before
  7115.  being taken on the tenth pass.
  7116.  
  7117.       >BP STATS 10 "?COUNTER = COUNTER + 1;G"
  7118.       >
  7119.  
  7120.  The example above creates a breakpoint at the address of the routine STATS.
  7121.  The breakpoint is passed over nine times before being taken on the 10th
  7122.  pass. Each time execution stops for the breakpoint, the quoted commands are
  7123.  executed. The Display Expression command increments COUNTER, then the Go
  7124.  command restarts execution. If COUNTER is set to 0 when the breakpoint is
  7125.  set, this has the effect of counting the number of times the breakpoint is
  7126.  taken.
  7127.  
  7128.       >S-       ;* FORTRAN example - uses FORTRAN hexadecimal notation
  7129.       assembly
  7130.       >BP #0A94
  7131.       >G
  7132.       AX=0006  BX=304A  CX=000B  DX=465D  SP=3050  BP=3050  SI=00BB  DI=40D1
  7133.       DS=5064  ES=5064  SS=5064  CS=46A2  IP=0A94  NV UP EI PL NZ NA PENC
  7134.       46A2:0A94 7205         JB      __chkstk+13 (0A9B)      ;BR1
  7135.       >
  7136.  
  7137.  The example above first sets the mode to assembly and then creates a
  7138.  breakpoint at the hexadecimal (offset) address #0A94 in the default (CS)
  7139.  segment. (The same address would be specified as 0x0A94 with the C
  7140.  expression evaluator, and as &H0A9 with the BASIC expression evaluator.) The
  7141.  Go command (G) is then used to execute to the breakpoint. Note that in the
  7142.  output to the Go command, the breakpoint number is shown as an
  7143.  assembly-language comment (;BR1) to the right of the current instruction.
  7144.  The Go command displays this output only in sequential mode; in window mode
  7145.  no assembly-language information appears.
  7146.  
  7147.  
  7148.  7.2  Breakpoint Clear Command
  7149.  
  7150.  The Breakpoint Clear command (BC) permanently removes one or more previously
  7151.  set breakpoints.
  7152.  
  7153.  Mouse
  7154.  
  7155.  To clear a single breakpoint with the mouse, point to the breakpoint line or
  7156.  instruction you want to clear. Breakpoint lines are shown in high-intensity
  7157.  text. Press the left mouse button. The line will be shown in normal text to
  7158.  indicate that the breakpoint has been removed.
  7159.  
  7160.  To remove all breakpoints with the mouse, point to Run on the menu bar,
  7161.  press a mouse button and drag the highlight down to the Clear Breakpoints
  7162.  selection, then release the button.
  7163.  
  7164.  Keyboard
  7165.  
  7166.  To clear a single breakpoint with a keyboard command, move the cursor to the
  7167.  breakpoint line or instruction you want to clear. Breakpoint lines are shown
  7168.  in high-intensity text. Press F9. The line will be shown in normal text to
  7169.  indicate that the breakpoint has been removed.
  7170.  
  7171.  To remove all breakpoints using a keyboard command, press ALT+R to open the
  7172.  Run menu, and then press ALT+C to select Clear Breakpoints.
  7173.  
  7174.  Dialog
  7175.  
  7176.  To clear breakpoints using a dialog command, enter a command line with the
  7177.  following syntax:
  7178.  
  7179.       BC list
  7180.       BC *
  7181.  
  7182.  If list is specified, the command removes the breakpoints named in the list.
  7183.  The list can be any combination of integer values from 0 to 19. You can use
  7184.  the Breakpoint List command (BL) if you need to see the numbers for each
  7185.  existing breakpoint. If an asterisk (*) is given as the argument, all
  7186.  breakpoints are removed.
  7187.  
  7188.  Examples
  7189.  
  7190.       >BC 0 4 8
  7191.       >
  7192.  
  7193.  The example above removes breakpoints 0, 4, and 8.
  7194.  
  7195.       >BC *
  7196.       >
  7197.  
  7198.  The example above removes all breakpoints.
  7199.  
  7200.  
  7201.  7.3  Breakpoint Disable Command
  7202.  
  7203.  The Breakpoint Disable command (BD) temporarily disables one or more
  7204.  existing breakpoints. The breakpoints are not deleted. They can be restored
  7205.  at any time using the Breakpoint Enable command (BE).
  7206.  
  7207.  When a breakpoint is disabled in window mode, it is shown in the display
  7208.  window with normal text; when enabled, it is shown in high-intensity text.
  7209.  
  7210.  ───────────────────────────────────────────────────────────────────────────
  7211.  NOTE
  7212.     All disabled breakpoints are automatically enabled whenever you restart
  7213.     the program being debugged. The program can be restarted with the Start
  7214.     or Restart selection from the Run menu, or with the Restart dialog
  7215.     command(L). See Chapter 5, "Executing Code."
  7216.  ───────────────────────────────────────────────────────────────────────────
  7217.  
  7218.  Mouse
  7219.  
  7220.  The Breakpoint Disable command cannot be executed with the mouse.
  7221.  
  7222.  Keyboard
  7223.  
  7224.  The Breakpoint Disable command cannot be executed with a keyboard command.
  7225.  
  7226.  Dialog
  7227.  
  7228.  To disable breakpoints with a dialog command, enter a command line with the
  7229.  following syntax:
  7230.  
  7231.       BD list
  7232.       BD *
  7233.  
  7234.  If list is specified, the command disables the breakpoints named in the
  7235.  list. The list can be any combination of integer values from 0 to 19. Use
  7236.  the Breakpoint List command (BL) if you need to see the numbers for each
  7237.  existing breakpoint. If an asterisk (*) is given as the argument, all
  7238.  breakpoints are disabled.
  7239.  
  7240.  The window commands for setting and clearing breakpoints can also be used to
  7241.  enable or clear disabled breakpoints.
  7242.  
  7243.  Examples
  7244.  
  7245.       >BD 0 4 8
  7246.       >
  7247.  
  7248.  The example above disables breakpoints 0, 4, and 8.
  7249.  
  7250.       >BD *
  7251.       >
  7252.  
  7253.  The example above disables all breakpoints.
  7254.  
  7255.  
  7256.  7.4  Breakpoint Enable Command
  7257.  
  7258.  The Breakpoint Enable command (BE) enables breakpoints that have been
  7259.  temporarily disabled with the Breakpoint Disable command.
  7260.  
  7261.  Mouse
  7262.  
  7263.  To enable a disabled breakpoint with the mouse, point to the source line or
  7264.  instruction of the breakpoint, and click Left. The line will be displayed in
  7265.  high-intensity text, and will remain so until you remove or disable the
  7266.  breakpoint. This is the same as creating a new breakpoint at that location.
  7267.  
  7268.  Keyboard
  7269.  
  7270.  To enable a disabled breakpoint using a keyboard command, move the cursor to
  7271.  the source line or instruction of the breakpoint, and press F9. The line is
  7272.  displayed in high-intensity text and remains so until you remove or disable
  7273.  the breakpoint. This is the same as creating a new breakpoint at that
  7274.  location.
  7275.  
  7276.  Dialog
  7277.  
  7278.  To enable breakpoints using a dialog command, enter a command line with the
  7279.  following syntax:
  7280.  
  7281.       BE list
  7282.       BE *
  7283.  
  7284.  If list is specified, the command enables the breakpoints named in the list.
  7285.  The list can be any combination of integer values from 0 to 19. Use the
  7286.  Breakpoint List command (BL) if you need to see the numbers for each
  7287.  existing breakpoint. If an asterisk (*) is given as the argument, all
  7288.  breakpoints are enabled. The CodeView debugger ignores all or part of the
  7289.  command if you try to enable a breakpoint that is not disabled.
  7290.  
  7291.  Examples
  7292.  
  7293.       >BE 0 4 8
  7294.       >
  7295.  
  7296.  The example above enables breakpoints 0, 4, and 8.
  7297.  
  7298.       >BE*
  7299.       >
  7300.  
  7301.  The example above enables all disabled breakpoints.
  7302.  
  7303.  
  7304.  7.5  Breakpoint List Command
  7305.  
  7306.  The Breakpoint List command (BL) lists current information about all
  7307.  breakpoints.
  7308.  
  7309.  Mouse
  7310.  
  7311.  The Breakpoint List command cannot be executed with the mouse.
  7312.  
  7313.  Keyboard
  7314.  
  7315.  The Breakpoint List command cannot be executed with a keyboard command.
  7316.  
  7317.  Dialog
  7318.  
  7319.  To list breakpoints with a dialog command, enter a command line with the
  7320.  following syntax:
  7321.  
  7322.       BL
  7323.  
  7324.  The command displays the breakpoint number, the enabled status (e for
  7325.  "enabled," d for "disabled"), the address, the routine, and the line number.
  7326.  
  7327.  If the breakpoint does not fall on a line number, an offset is shown from
  7328.  the nearest previous line number. The pass count and break commands are
  7329.  shown if they have been set. If no breakpoints are currently defined,
  7330.  nothing is displayed.
  7331.  
  7332.  Example
  7333.  
  7334.       >BL
  7335.       0 e 56C4:0105  _ARCTAN:10
  7336.       1 d 56C4:011E  _ARCTAN:19             (pass = 10) "T;T"
  7337.       2 e 56C4:00FD  _ARCTAN:9+6
  7338.       >
  7339.  
  7340.  In the example above, breakpoint 0 is enabled at address 56C4:0105. This
  7341.  address is in routine ARCTAN and is at line 10 of the current source file.
  7342.  No pass count or break commands have been set.
  7343.  
  7344.  Breakpoint 1 is currently disabled, as indicated by the d after the
  7345.  breakpoint number. It also has a pass count of 10, meaning that the
  7346.  breakpoint will not be taken until the 10th time it is encountered. The
  7347.  command string at the end of the line indicates that each time the
  7348.  breakpoint is taken, the Trace command will automatically be executed twice.
  7349.  
  7350.  The line number for breakpoint 2 has an offset. The address is six bytes
  7351.  beyond the address for line 9 in the current source file. Therefore, the
  7352.  breakpoint was probably set in assembly mode, since it would be difficult to
  7353.  set a breakpoint anywhere except on a source line in source mode.
  7354.  
  7355.  
  7356.  Chapter 8  Managing Watch Statements
  7357.  ───────────────────────────────────────────────────────────────────────────
  7358.  
  7359.  Watch Statement commands are among the Microsoft CodeView debugger's most
  7360.  powerful features. They enable you to set, delete, and list watch
  7361.  statements. Watch statements describe expressions or areas of memory to
  7362.  watch. Some watch statements specify conditional breakpoints, which depend
  7363.  upon the value of the expression or memory area.
  7364.  
  7365.  Syntax for each CodeView command is always the same, regardless of the
  7366.  expression evaluator; however, the method for specifying an argument may
  7367.  vary with the language. Therefore, each example in this chapter is repeated
  7368.  with C, FORTRAN, and BASIC arguments. The sample screens throughout the text
  7369.  that present these examples feature BASIC. At the end of this chapter are C
  7370.  and FORTRAN sample screens that incorporate all the previous examples
  7371.  (except for Watch Delete and Watch List).
  7372.  
  7373.  
  7374.  8.1  Watch Statement Commands
  7375.  
  7376.  The Watch Statement commands are summarized below:
  7377.  
  7378.  Command                     Action
  7379.  
  7380.  Watch (W)                   Sets an expression or range of memory to be
  7381.                              watched
  7382.  
  7383.  Watchpoint (WP)             Sets a conditional breakpoint that will be taken
  7384.                              when the expression becomes nonzero (true)
  7385.  
  7386.  Tracepoint (TP)             Sets a conditional breakpoint that will be taken
  7387.                              when a given expression or range of memory
  7388.                              changes
  7389.  
  7390.  Watch Delete (Y)            Deletes one or more watch statements
  7391.  
  7392.  Watch List (W)              Lists current watch statements
  7393.  
  7394.  Watch statements, like breakpoints, remain in memory until you specifically
  7395.  remove them or quit the CodeView debugger. They are not canceled when you
  7396.  restart the program being debugged. Therefore, you can set a complicated
  7397.  series of watch statements once and then execute through the program several
  7398.  times without resetting.
  7399.  
  7400.  In window mode, Watch Statement commands can be entered either in the dialog
  7401.  window or with menu selections. Current watch statements are shown in a
  7402.  watch window that appears between the menu bar and the source window.
  7403.  
  7404.  In sequential mode, the Watch, Tracepoint, and Watchpoint commands can be
  7405.  used, but since there is no watch window, you cannot see the watch
  7406.  statements and their values. You must use the Watch List command to examine
  7407.  the current watch statements.
  7408.  
  7409.  To set a watch statement containing a local variable, you must be in the
  7410.  function where the variable is defined. If the current line is not in the
  7411.  function, the CodeView debugger displays the message UNKNOWN SYMBOL. When
  7412.  you exit from a function containing a local variable referenced in a watch
  7413.  statement, the value of the statement is displayed as UNKNOWN SYMBOL. When
  7414.  you reenter the function, the local variable will again have a value. With
  7415.  the C and FORTRAN expression evaluators, you can avoid this limitation by
  7416.  using the period operator to specify both the function and the variable. For
  7417.  example, enter main.x instead of just x.
  7418.  
  7419.  
  7420.  8.2  Setting Watch-Expression and Watch-Memory Statements
  7421.  
  7422.  The Watch command is used to set a watch statement that specifies an
  7423.  expression (watch-expression statement) or a range of addresses in memory
  7424.  (watch-memory statement). The value or values specified by this watch
  7425.  statement are shown in the watch window. The watch window is updated to show
  7426.  new values each time the value of the watch statement changes during program
  7427.  execution. Since the watch window does not exist in sequential mode, you
  7428.  must use the Watch List command to examine the values of watch statements.
  7429.  
  7430.  When setting a watch expression, you can specify the format in which the
  7431.  value will be displayed. Type the expression followed by a comma and a
  7432.  format specifier. If you do not give a format specifier, the CodeView
  7433.  debugger displays the value in a default format. See Section 6.1, "Display
  7434.  Expression Command," for more information about type specifiers and the
  7435.  default format.
  7436.  
  7437.  ───────────────────────────────────────────────────────────────────────────
  7438.  NOTE
  7439.     If your program directly accesses absolute addresses used by IBM or
  7440.     IBM-compatible computers, you may sometimes get unexpected results with
  7441.     the Display Expression and Dump commands. However, the Watch command will
  7442.     usually show the correct values. This problem can arise if the CodeView
  7443.     debugger and your program begin to use the same memory location.
  7444.     The problem often occurs when a program reads data directly from the
  7445.     screen buffer of the display adapter. If you have an array called screen
  7446.     that is initialized to the starting address of the screen buffer, the
  7447.     command DB screen L 16 will display data from the CodeView display rather
  7448.     than from the display of the program you are debugging. The command WB
  7449.     screen L 16 will display data from the program's display (provided screen
  7450.     swapping or screen flipping was specified at start-up). The Watch command
  7451.     behaves differently from the Dump command because watch-statement values
  7452.     are updated during program execution, and any values read from the screen
  7453.     buffer will be taken from the output screen rather than from the
  7454.     debugging screen.
  7455.  ───────────────────────────────────────────────────────────────────────────
  7456.  
  7457.  Mouse
  7458.  
  7459.  To set a watch-expression statement using the mouse, point to Watch on the
  7460.  menu bar, press a mouse button and drag the highlight down to the Add Watch
  7461.  selection, and then release the button. A dialog box appears, asking for the
  7462.  expression to be watched. Type the expression and press the ENTER key or a
  7463.  mouse button.
  7464.  
  7465.  You cannot use the mouse version of the command to specify a range of memory
  7466.  to be watched, as you can with the dialog version.
  7467.  
  7468.  Keyboard
  7469.  
  7470.  To set a watch-expression statement with a keyboard command, press ALT+W to
  7471.  open the Watch menu, and then type A (uppercase or lowercase) to select Add
  7472.  Watch. You can also select the Add Watch command directly by pressing
  7473.  CONTROL+W. A dialog box appears, asking for the expression to be watched.
  7474.  Type the expression and press the ENTER key.
  7475.  
  7476.  You cannot use the keyboard version of the command to specify a range of
  7477.  memory to be watched, as you can with the dialog version.
  7478.  
  7479.  Dialog
  7480.  
  7481.  To set a watch-expression statement with a dialog command, enter a command
  7482.  line with the following syntax:
  7483.  
  7484.       W? expression«,format»
  7485.  
  7486.  To set a watch-memory command with a dialog command, enter a command line
  7487.  with the following syntax:
  7488.  
  7489.       W«type» range
  7490.  
  7491.  An expression used with the Watch command can be either a simple variable or
  7492.  a complex expression using several variables and operators. The expression
  7493.  should be no longer than the width of the watch window. The characters
  7494.  permitted for format correspond to format arguments used in a C printf
  7495.  function call. See Section 6.1, "Display Expression Command," for more
  7496.  information on format arguments.
  7497.  
  7498.  When watching a memory location, type is a one-letter size specifier from
  7499.  the following list:
  7500.  
  7501.  Specifier                   Size
  7502.  
  7503.  None                        Default type
  7504.  
  7505.  B                           Byte
  7506.  
  7507.  A                           ASCII
  7508.  
  7509.  I                           Integer (signed decimal word)
  7510.  
  7511.  U                           Unsigned (unsigned decimal word)
  7512.  
  7513.  WP                          Word
  7514.  
  7515.  D                           Double word
  7516.  
  7517.  S                           Short real
  7518.  
  7519.  L                           Long real
  7520.  
  7521.  T                           10-byte real
  7522.  
  7523.  If no type size is specified, the default type used is the last type used by
  7524.  a Dump, Enter, Watch Memory, or Tracepoint Memory command. If none of these
  7525.  commands has been used during the session, the default type is byte.
  7526.  
  7527.  The data will be displayed in a format similar to that used by the Dump
  7528.  commands (see Section 6.1, "Display Expression Command," for more
  7529.  information on format arguments). The range can be any length, but only one
  7530.  line of data will be displayed in the watch window. If you do not specify an
  7531.  ending address for the range, the default range is one object.
  7532.  
  7533.  Examples
  7534.  
  7535.  The following three examples display watch statements in the watch window.
  7536.  
  7537.       W? n
  7538.  
  7539.  The example above displays the current value of the variable n.
  7540.  
  7541.       W? higher * 100
  7542.  
  7543.  The example above displays the value of the expression higher* 100.
  7544.  
  7545.       WL chance
  7546.  
  7547.  The example above displays the value of chance,  a double-precision
  7548.  floating-point variable. Exactly how chance is stored in memory is shown
  7549.  first. (The command W? chance would display the value of chance but not any
  7550.  actual bytes of memory.)
  7551.  
  7552.  These commands, entered while debugging a BASIC program, produce the watch
  7553.  window in Figure 8.1. Corresponding C and FORTRAN examples are included with
  7554.  other commands in language-specific sections at the end of the chapter.
  7555.  
  7556.  
  7557.  8.3  Setting Watchpoints
  7558.  
  7559.  The Watchpoint command is used to set a conditional breakpoint called a
  7560.  watchpoint. A watchpoint breaks program execution when the expression
  7561.  described by its watch statement becomes true. You can think of watchpoints
  7562.  as "break when" points, since the break occurs when the specified expression
  7563.  becomes true (nonzero).
  7564.  
  7565.  A watch statement created by the Watchpoint command describes the expression
  7566.  that will be watched and compared to 0. The statement remains in memory
  7567.  until you delete it or quit the CodeView debugger. Any valid CodeView
  7568.  expression can be used as the watchpoint expression as long as the
  7569.  expression is not wider than the watch window.
  7570.  
  7571.  In window mode, watchpoint statements and their values are displayed in
  7572.  high-intensity text in the watch window. In sequential mode, there is no
  7573.  watch window, so the values of watchpoint statements can only be displayed
  7574.  with the Watch List command (see Section 8.6 "Listing Watchpoints and
  7575.  Tracepoints," for more information).
  7576.  
  7577.  Although watchpoints can be any valid CodeView expression, the command works
  7578.  best with expressions that use the relational operators (such as < and > for
  7579.  C and BASIC, or .LT. and .GT. for FORTRAN). Relational expressions always
  7580.  evaluate to false (zero) or true (nonzero). Care must be taken with other
  7581.  kinds of expressions when they are used as watchpoints, because the
  7582.  watchpoints will break execution whenever they do not equal precisely zero.
  7583.  For example, your program might use a loop variable  I, which ranges from 1
  7584.  to 100. If you entered I as a watchpoint, then it would always suspend
  7585.  program execution, since I is never equal to 0. However, the relational
  7586.  expression I>90 (or I.GT.90) would not suspend program execution until I
  7587.  exceeded 90.
  7588.  
  7589.  Mouse
  7590.  
  7591.  To set a watchpoint statement with the mouse, point to Watch on the menu
  7592.  bar, press a mouse button and drag the highlight down to the Watchpoint
  7593.  selection, and then release the button. A dialog box appears, asking for the
  7594.  expression to be watched. Type the expression and press the ENTER key or a
  7595.  mouse button.
  7596.  
  7597.  Keyboard
  7598.  
  7599.  To execute the Watchpoint command with a keyboard command, press ALT+W to
  7600.  open the Watch menu, and then press ALT+W to select Watchpoint. A dialog box
  7601.  appears, asking for the expression to be watched. Type the expression and
  7602.  press the ENTER key.
  7603.  
  7604.  Dialog
  7605.  
  7606.  To set a watchpoint using a dialog command, enter a command line with the
  7607.  following syntax:
  7608.  
  7609.       WP? expression«,format»
  7610.  
  7611.  The expression can be any valid CodeView expression (usually a relational
  7612.  expression). You can enter a format specifier, but there is little reason to
  7613.  do so, since the expression value is normally either 1 or 0.
  7614.  
  7615.  Examples
  7616.  
  7617.  The following dialog commands display two watch statements (watchpoints) in
  7618.  the watch window:
  7619.  
  7620.       WP? higher > chance      ;* BASIC/C
  7621.       WP? higher .gt. chance   ;* FORTRAN example
  7622.  
  7623.  The examples above instruct the CodeView debugger to break execution when
  7624.  the variable higher is greater than the variable chance. (Note that BASIC
  7625.  and C happen to use the same syntax in this case, but FORTRAN uses its own.)
  7626.  After setting this watchpoint, you could use the Go command to execute until
  7627.  the condition becomes true.
  7628.  
  7629.       WP? n=7 or n=11           ;* BASIC example
  7630.       WP? n==7 || n==11         ;* C example
  7631.       WP? n.eq.7 .or. n.eq.11   ;* FORTRAN example
  7632.  
  7633.  The examples above instruct the CodeView debugger to break execution when
  7634.  the variable n is equal to 7 or 11.
  7635.  
  7636.  ───────────────────────────────────────────────────────────────────────────
  7637.  NOTE
  7638.     BASIC and C will each display a numerical result in response to a Boolean
  7639.     expression (0 being equivalent to false, nonzero to true). However, the
  7640.     corresponding FORTRAN condition will be displayed with either .TRUE. or
  7641.     .FALSE. in the watch window.
  7642.  ───────────────────────────────────────────────────────────────────────────
  7643.  
  7644.  These commands, entered while debugging a BASIC program, produce the watch
  7645.  window shown in Figure 8.2. Corresponding C and FORTRAN examples are
  7646.  included with other commands, at the end of the chapter.
  7647.  
  7648.  ───────────────────────────────────────────────────────────────────────────
  7649.  NOTE
  7650.     Setting watchpoints significantly slows execution of the program being
  7651.     debugged. The CodeView debugger checks if the expression is true each
  7652.     time a source line is executed in source mode, or each time an
  7653.     instruction is executed in assembly mode. Be careful when setting
  7654.     watchpoints near large or nested loops. A loop that executes almost
  7655.     instantly when run from MS-DOS can take many minutes if executed from
  7656.     within the debugger with several watchpoints set.
  7657.  
  7658.     Tracepoints do not slow CodeView execution as much as watchpoints, so you
  7659.     should use tracepoints when possible. For example, although you can set a
  7660.     watchpoint on a Boolean variable (WP? moving), a trace-point on the same
  7661.     variable (TP?moving) has essentially the same effect and does not slow
  7662.     execution as much.
  7663.  
  7664.     If you enter a seemingly endless loop, press CONTROL+BREAK or CONTROL+C
  7665.     to exit. You will soon learn the size of loop you can safely execute when
  7666.     watchpoints are set.
  7667.  ───────────────────────────────────────────────────────────────────────────
  7668.  
  7669.  
  7670.  8.4  Setting Tracepoints
  7671.  
  7672.  The Tracepoint command is used to set a conditional breakpoint called a
  7673.  tracepoint. A tracepoint breaks program execution when the value of a
  7674.  specified expression or range of memory changes.
  7675.  
  7676.  The watch statement created by the Tracepoint command describes the
  7677.  expression or memory range to be watched and tested for change. The
  7678.  statement remains in memory until you delete it or quit the CodeView
  7679.  debugger.
  7680.  
  7681.  In window mode, tracepoint statements and their values are shown in
  7682.  high-intensity text in the watch window. In sequential mode, there is no
  7683.  watch window, so the values of tracepoint statements can only be displayed
  7684.  with the Watch List command (see Section 8.5, "Listing Watchpoints and
  7685.  Tracepoints," for more information).
  7686.  
  7687.  An expression used with the Tracepoint command must evaluate to an "lvalue."
  7688.  In other words, the expression must refer to an area of memory rather than a
  7689.  constant. Furthermore, the area of memory must be not more than 128 bytes in
  7690.  size. For example, i==10 (which is similar to I.EQ.10 in FORTRAN and I=10
  7691.  in BASIC) would be invalid because it is either 1 (true) or 0 (false) rather
  7692.  than a value stored in memory. The expression sym1+sym2 is invalid because
  7693.  it is the calculated sum of the value of two memory locations. The
  7694.  expression buffer would be invalid if buffer is an array of 130 bytes, but
  7695.  valid if the array is 120 bytes. (However, using array names this way is not
  7696.  valid with BASIC modules because BASIC uses array descriptors.) Note that if
  7697.  buffer is declared as an array of 64 bytes, then the Tracepoint command
  7698.  given with the expression buffer checks all 64 bytes of the array. The same
  7699.  command given with the C expression buffer[32], or BUFFER(33) in FORTRAN or
  7700.  BASIC, means that only one byte (the 33rd) will be checked. (Note that C and
  7701.  FORTRAN index the same element differently.)
  7702.  
  7703.  ───────────────────────────────────────────────────────────────────────────
  7704.  NOTE
  7705.     The following is relevant only to C programs.
  7706.  
  7707.     Register variables are not considered values. Therefore, if i is declared
  7708.     as register int i, the command TP?i is invalid. However, you can still
  7709.     check for changes in the value of i. Use the Examine Symbols command to
  7710.     learn which register contains the value of i .
  7711.  
  7712.     Then learn the value of i. Finally, set up a watchpoint to test the
  7713.     value. For example, use the following sequence of commands:
  7714.  
  7715.       >X? i
  7716.       3A79:0264 int              div()
  7717.                   SI        int              i
  7718.       >?i
  7719.       10
  7720.       >WP? @SI!=10
  7721.       >
  7722.  ───────────────────────────────────────────────────────────────────────────
  7723.  
  7724.  When setting a tracepoint expression, you can specify the format in which
  7725.  the value will be displayed. Type the expression followed by a comma and a
  7726.  type specifier. If you do not give a type specifier, the CodeView debugger
  7727.  displays the value in a default format. See Section 6.1,"Display Expression
  7728.  Command," for more information about type specifiers and the default format.
  7729.  
  7730.  Mouse
  7731.  
  7732.  To set a tracepoint-expression statement with the mouse, point to Watch on
  7733.  the menu bar, press a mouse button and drag the highlight down to the
  7734.  Tracepoint selection, and then release the button. A dialog box appears,
  7735.  asking for the expression to be watched. Type the expression, and press the
  7736.  ENTER key or a mouse button.
  7737.  
  7738.  You cannot specify a range of memory to be watched with the mouse version of
  7739.  the command, as you can with the dialog version.
  7740.  
  7741.  Keyboard
  7742.  
  7743.  To set a tracepoint-expression statement with a keyboard command, press
  7744.  ALT+W to open the Watch menu, and then press ALT+T to select Tracepoint. A
  7745.  dialog box appears, asking for the expression to be watched. Type the
  7746.  expression and press the ENTER key.
  7747.  
  7748.  You cannot use the keyboard version of the command to specify a range of
  7749.  memory to be watched, as you can with the dialog version.
  7750.  
  7751.  Dialog
  7752.  
  7753.  To set a tracepoint with a dialog command, enter a command line with one of
  7754.  the following forms of syntax:
  7755.  
  7756.       TP? expression,«format»
  7757.       TP«type» range
  7758.  
  7759.  The first syntax line above sets a tracepoint expression; the second line
  7760.  sets a tracepoint memory.
  7761.  
  7762.  An expression used with the Tracepoint command can be either a simple
  7763.  variable or a complex expression using several variables and operators. The
  7764.  expression should not be longer than the width of the watch window. You can
  7765.  specify format using a C printf type specifier if you do not want the value
  7766.  to be displayed in the default format (decimal for integers or floating
  7767.  point for real numbers). See Section 6.1, "Display Expression Command," for
  7768.  more information on format arguments.
  7769.  
  7770.  In the memory-tracepoint form, range must be a valid address range and type
  7771.  must be a one-letter memory-size specifier. If you specify only the start of
  7772.  the range, the CodeView debugger displays one object as the default.
  7773.  
  7774.  Although no more than one line of data will be displayed in the watch
  7775.  window, the range to be checked for change can be any size up to 128 bytes.
  7776.  
  7777.  The data will be displayed in the format used by the Dump commands (see
  7778.  Section 6.1, "Display Expression Command," for more information on format
  7779.  arguments). The valid memory-size specifiers are listed below:
  7780.  
  7781.  Specifier                   Size
  7782.  
  7783.  None                        Default type
  7784.  
  7785.  B                           Byte
  7786.  
  7787.  A                           ASCII
  7788.  
  7789.  I                           Integer (signed decimal word)
  7790.  
  7791.  U                           Unsigned (unsigned decimal word)
  7792.  
  7793.  WP                          Word
  7794.  
  7795.  D                           Double word
  7796.  
  7797.  S                           Short real
  7798.  
  7799.  L                           Long real
  7800.  
  7801.  T                           10-byte real
  7802.  
  7803.  The default type used if no type size is specified is the last type used by
  7804.  a Dump, Enter, Watch Memory, or Tracepoint Memory command. If none of these
  7805.  commands has been used during the session, the default type is byte.
  7806.  
  7807.  Examples
  7808.  
  7809.  The two dialog commands below display watch statements (tracepoints) in the
  7810.  watch window.
  7811.  
  7812.       TP? sum
  7813.  
  7814.  The example above instructs the CodeView debugger to suspend program
  7815.  execution whenever the value of the variable sum changes.
  7816.  
  7817.       TPB n
  7818.  
  7819.  The example above instructs the CodeView debugger to suspend program
  7820.  execution whenever the first byte at the address of n changes; the address
  7821.  of this byte and its contents are displayed. The value of n may change
  7822.  because of a change in the second byte at the address of n; but that change
  7823.  (by itself) would have no effect on this tracepoint.
  7824.  
  7825.  These commands, entered while debugging a BASIC program, produce the watch
  7826.  window in Figure 8.3. Corresponding C and FORTRAN examples are included,
  7827.  with other commands, at the end of the chapter.
  7828.  
  7829.  ───────────────────────────────────────────────────────────────────────────
  7830.  NOTE
  7831.     Setting tracepoints significantly slows execution of the program being
  7832.     debugged. The CodeView debugger has to check to see if the expression or
  7833.     memory range has changed each time a source line is executed in source
  7834.     mode or each time an instruction is executed in assembly mode. However,
  7835.     tracepoints do not slow execution as much as do watchpoints.
  7836.  
  7837.     Be careful when setting tracepoints near large or nested loops. A loop
  7838.     that executes almost instantly when run from the MS-DOS operating system
  7839.     can take many minutes if executed from within the debugger with several
  7840.     tracepoints set. If you enter a seemingly endless loop, press
  7841.     CONTROL+BREAK or CONTROL+C to exit. Often you can tell how far you went
  7842.     in the loop by the value of the tracepoint when you exited.
  7843.  ───────────────────────────────────────────────────────────────────────────
  7844.  
  7845.  
  7846.  8.5  Deleting Watch Statements
  7847.  
  7848.  The Watch Delete command enables you to delete watch statements that were
  7849.  set previously with the Watch, Watchpoint, or Tracepoint command.
  7850.  
  7851.  When you delete a watch statement in window mode, the statement disappears
  7852.  and the watch window closes around it. For example, if there are three watch
  7853.  statements in the window and you delete statement 1, the window is redrawn
  7854.  with one less line. Statement 0 remains unchanged, but statement 2 becomes
  7855.  statement 1. If there is only one statement, the window disappears.
  7856.  
  7857.  Mouse
  7858.  
  7859.  To delete a watch statement with the mouse, point to Watch on the menu bar,
  7860.  press a mouse button and drag the highlight down to the Delete Watch
  7861.  selection, and then release the button. A dialog box appears, containing all
  7862.  the watch statements. Point to the statement you want to delete and press
  7863.  the ENTER key or a mouse button. The dialog box disappears, and the watch
  7864.  window is redrawn without the watch statement.
  7865.  
  7866.  You can also delete all the statements in the watch window at once, simply
  7867.  by selecting the Delete All selection.
  7868.  
  7869.  Keyboard
  7870.  
  7871.  To execute the Delete Watch command with a keyboard command, press ALT+W to
  7872.  open the Watch menu, and then type D (uppercase or lowercase) to select
  7873.  Delete Watch. You can also select the Delete Watch command directly by
  7874.  pressing CONTROL+U. A dialog box appears, containing all the watch
  7875.  statements. Use the UP and DOWN keys to move the cursor to the statement
  7876.  you want to delete, and then press the ENTER key. The dialog box disappears,
  7877.  and the watch window is redrawn without the watch statement.
  7878.  
  7879.  You can also delete all the statements in the watch window at once, simply
  7880.  by selecting the Delete All selection. Do this by pressing L (upppercase or
  7881.  lowercase) after the Watch menu is open.
  7882.  
  7883.  Dialog
  7884.  
  7885.  To delete watch statements with a dialog command, enter a command line with
  7886.  the following syntax:
  7887.  
  7888.       Y number
  7889.  
  7890.  When you set a watch statement, it is automatically assigned a number
  7891.  (starting with 0). In window mode, the number appears to the left of the
  7892.  watch statement in the watch window. In sequential mode, you can use the
  7893.  Watch List (W) command to view the numbers of current watch statements.
  7894.  
  7895.  You can delete existing watch statements by specifying the number of the
  7896.  statement you want to delete with the Delete Watch command. (The Y is a
  7897.  mnemonic for "yank.")
  7898.  
  7899.  You can use the asterisk (*) to represent all watch statements.
  7900.  
  7901.  Examples
  7902.  
  7903.       >Y 2
  7904.       >
  7905.  
  7906.  The command above deletes watch statement 2.
  7907.  
  7908.       >Y *
  7909.       >
  7910.  
  7911.  The command above deletes all watch statements and closes the watch window.
  7912.  
  7913.  
  7914.  8.6  Listing Watchpoints and Tracepoints
  7915.  
  7916.  The Watch List command lists all previously set watchpoints and tracepoints
  7917.  with their assigned numbers and their current values.
  7918.  
  7919.  This command is the only way to examine current watch statements in
  7920.  sequential mode. The command has little use in window mode, since watch
  7921.  statements are already visible in the watch window as shown in Figure 8.4.
  7922.  
  7923.  Mouse
  7924.  
  7925.  The Watch List command cannot be executed with the mouse.
  7926.  
  7927.  Keyboard
  7928.  
  7929.  The Watch List command cannot be executed with a keyboard command.
  7930.  
  7931.  Dialog
  7932.  
  7933.  To list watch statements with a dialog command, enter a command line with
  7934.  the following syntax:
  7935.  
  7936.       >W
  7937.  
  7938.  The display is the same as the display that appears in the watch window in
  7939.  window mode shown in Figure 8.5.
  7940.  
  7941.  Example
  7942.  
  7943.       >W
  7944.       0) code,c  :  I
  7945.       1) (float)letters/words,f  :  4.777778
  7946.       2) 3F65:0B20  20 20 43 4F 55 4E 54 COUNT
  7947.       3) lines==11 :  0
  7948.       >
  7949.  
  7950.  ───────────────────────────────────────────────────────────────────────────
  7951.  NOTE
  7952.     The command letter for the Watch List command is the same as the command
  7953.     letter for the memory version of the Watch command when no memory size is
  7954.     given. The difference between the commands is that the Watch List command
  7955.     never takes an argument. The Watch command always requires at least one
  7956.     argument.
  7957.  ───────────────────────────────────────────────────────────────────────────
  7958.  
  7959.  
  7960.  8.7  C Examples
  7961.  
  7962.  The seven examples shown previously in a BASIC screen would be entered in a
  7963.  C debugging session as follows:
  7964.  
  7965.  The first three items in the watch window are simple watch statements. They
  7966.  display values but never cause execution to break.
  7967.  
  7968.  The next two items are watchpoints; they cause execution to break whenever
  7969.  they evaluate to true (nonzero). The fourth item will break execution
  7970.  whenever higher is greater than chance, and the fifth item will break
  7971.  execution whenever n is equal to 7 or 11.
  7972.  
  7973.  The last two items are tracepoints, which cause execution to break whenever
  7974.  any bytes change within a specified area of memory. The sixth item breaks
  7975.  execution whenever the value of sum changes; the seventh item breaks
  7976.  execution whenever there is a change in the first byte at the address of n.
  7977.  
  7978.  
  7979.  8.8  FORTRAN Examples
  7980.  
  7981.  The seven examples shown previously in a BASIC screen would be entered in a
  7982.  FORTRAN debugging session as follows:
  7983.  
  7984.  The first three items in the watch window are simple watch statements. They
  7985.  display values but never cause execution to break.
  7986.  
  7987.  The next two items are watchpoints; they cause execution to break whenever
  7988.  they evaluate to true (nonzero). The fourth item will break execution
  7989.  whenever higher is greater than chance, and the fifth item will break
  7990.  execution whenever n is equal to 7 or 11.
  7991.  
  7992.  The last two items are tracepoints, which cause execution to break whenever
  7993.  any bytes change within a specified area of memory. The sixth item breaks
  7994.  execution whenever the value of sum changes; the seventh item breaks
  7995.  execution whenever there is a change in the first byte at the address of n .
  7996.  
  7997.  
  7998.  8.9  Assembly Examples
  7999.  
  8000.  By default, assembly source modules are debugged with the C expression
  8001.  evaluator. Therefore, refer to the C examples for appropriate syntax for
  8002.  entering watch expressions.
  8003.  
  8004.  In addition, certain C expressions tend to be more useful for debugging
  8005.  assembly modules. The following examples show some typical cases used with
  8006.  watch and tracepoint commands.
  8007.  
  8008.  Examples
  8009.  
  8010.       >WW sp L 8
  8011.       >WW bp L 8
  8012.       >W? wo bp+4,d
  8013.       >W? by bp-2,d
  8014.       >TPW arr L 5
  8015.       >
  8016.  
  8017.  The first two examples watch a range of memory. The watch command WW sp L 8
  8018.  is particularly useful because it will cause the debugger to watch the stack
  8019.  dynamically; the debugger will continually display the first eight words on
  8020.  the top of the stack as items are pushed and popped. The expression WW bp L
  8021.  8 is similar; it causes the debugger to watch the first eight words in
  8022.  memory pointed to by BP (the framepointer).
  8023.  
  8024.  The third example, W? wo bp+4,d, is useful if you are using the stack to
  8025.  pass parameters. In this case, the position on the stack four bytes above BP
  8026.  holds one of three integer parameters. The WO operator returns the same value
  8027.  as the assembler expression WORD PTR [bp+4]; the result is displayed in
  8028.  decimal.
  8029.  
  8030.  You must use the expression bp+4 in order to watch this parameter; you
  8031.  cannot specify a parameter by name. The assembler does not emit symbolic
  8032.  information for parameters. The fourth command, W? bybp-2,d, is similar to
  8033.  the third, but watches a local variable instead of watching a parameter. The
  8034.  operator BY returns the same value as the assembler expression BYTE PTR
  8035.  [bp-2].
  8036.  
  8037.  The final example sets a tracepoint on a range of memory, which corresponds
  8038.  to the first five words of the array arr. Range arguments for tracepoint and
  8039.  watch expressions are particularly useful for large data structures, such as
  8040.  arrays.
  8041.  
  8042.  The five examples above produce the screen shown in Figure 8.6 when entered
  8043.  in a CodeView debugging session.
  8044.  
  8045.  
  8046.  Chapter 9  Examining Code
  8047.  ───────────────────────────────────────────────────────────────────────────
  8048.  
  8049.  Several CodeView commands allow you to examine program code or data related
  8050.  to code. The following commands are discussed in this chapter:
  8051.  
  8052.  Command                     Action
  8053.  
  8054.  Set Mode (S)                Sets format for code displays
  8055.  
  8056.  Unassemble (U)              Displays assembly instructions
  8057.  
  8058.  View (V)                    Displays source lines
  8059.  
  8060.  Current Location (.)        Displays the current location line
  8061.  
  8062.  Stack Trace (K)             Displays routines or procedures
  8063.  
  8064.  
  8065.  9.1  Set Mode Command
  8066.  
  8067.  The Set Mode command sets the mode in which code is displayed. The two basic
  8068.  display modes are source mode in which the program is displayed as source
  8069.  lines, and assembly mode in which the program is displayed as
  8070.  assembly-language instructions. These two modes can be combined in mixed
  8071.  mode in which the program is displayed with both source lines and
  8072.  assembly-language instructions.
  8073.  
  8074.  In sequential mode, there are three display modes: source, assembly, and
  8075.  mixed. These modes affect the output of commands that display code
  8076.  (Register, Trace, Program Step, Go, Execute, and Unassemble).
  8077.  
  8078.  In window mode, these same display modes are available, but affect what kind
  8079.  of code appears in the display window.
  8080.  
  8081.  Source and mixed modes are only available if the executable file contains
  8082.  symbols in the CodeView format. Programs that do not contain symbolic
  8083.  information (including all .COM files) are displayed in assembly mode.
  8084.  
  8085.  Mouse
  8086.  
  8087.  To set the display mode with the mouse, point to View on the menu bar, press
  8088.  a mouse button and drag the highlight to either the Source selection for
  8089.  source mode, the Mixed selection for mixed mode, or the Assembly selection
  8090.  for assembly mode. Then release the button.
  8091.  
  8092.  You can further control the display of assembly-language instructions by
  8093.  making selections from the Options menu. See Section 2.1.3.6 for more
  8094.  information.
  8095.  
  8096.  Keyboard
  8097.  
  8098.  To change the display mode with a keyboard command, press F3. This will
  8099.  rotate the mode to the next setting; you may need to press F3 twice to get
  8100.  the desired mode. This command works in either window or sequential mode. In
  8101.  sequential mode, the word source, mixed, or assembly is displayed to
  8102.  indicate the new mode.
  8103.  
  8104.  Dialog
  8105.  
  8106.  To set the display mode from the dialog window, enter a command line with
  8107.  the following syntax:
  8108.  
  8109.       S«+ | - | &»
  8110.  
  8111.  If the plus sign is specified (S+), source mode is selected, and the word
  8112.  source is displayed.
  8113.  
  8114.  If the minus sign is specified (S-), assembly mode is selected, and the word
  8115.  assembly is displayed. In window mode, the display will include any
  8116.  assembly options, except the Mixed Source option, previously toggled on from
  8117.  the Options menu. The Mixed Source option is always turned off by the S-
  8118.  command.
  8119.  
  8120.  If the ampersand is specified (S&), mixed mode is selected, and the word
  8121.  mixed is displayed. In window mode, the display will include any assembly
  8122.  options previously toggled on from the Options menu. In addition, the Mixed
  8123.  Source option will be turned on by the S& command.
  8124.  
  8125.  If no argument is specified (S), the current mode (source, assembly, or
  8126.  mixed) is displayed.
  8127.  
  8128.  The Unassemble command in sequential mode is an exception in that it
  8129.  displays mixed, source, and assembly with both the source (S+) and mixed
  8130.  (S&) modes.
  8131.  
  8132.  When you enter the dialog version of the Set Mode command, the CodeView
  8133.  outputs the name of the new display mode: source, assembly, or mixed.
  8134.  
  8135.  Examples
  8136.  
  8137.       >S+
  8138.       source
  8139.       >S-
  8140.       assembly
  8141.       >S&
  8142.       mixed
  8143.       >
  8144.  
  8145.  The examples above show the source mode being changed to source, assembly,
  8146.  and mixed. In window mode, the commands change the format of the display
  8147.  window. In sequential mode, the commands change the output from the commands
  8148.  that display code (Register, Trace, Program Step, Go, Execute, and
  8149.  Unassemble). See the sections below on individual commands for examples of
  8150.  how they are affected by the display mode.
  8151.  
  8152.  
  8153.  9.2  Unassemble Command
  8154.  
  8155.  The Unassemble command displays the assembly-language instructions of the
  8156.  program being debugged. It is most useful in sequential mode, where it is
  8157.  the only method of examining a sequence of assembly-language instructions.
  8158.  In window mode, it can be used to display a specific portion of
  8159.  assembly-language code in the display window.
  8160.  
  8161.  Occasionally, code similar to the following will be displayed:
  8162.  
  8163.       FE30   ???   Byte Ptr  [BX + SI]
  8164.  
  8165.  If you attempt to unassemble data, the CodeView debugger may display
  8166.  meaningless instructions.
  8167.  
  8168.  Mouse
  8169.  
  8170.  The Unassemble command has no direct mouse equivalent, but you can view
  8171.  unassembled code at any time by changing the mode to assembly or mixed (see
  8172.  Section 9.1, "Set Mode Command," for more information).
  8173.  
  8174.  Keyboard
  8175.  
  8176.  The Unassemble command has no direct keyboard equivalent, but you can view
  8177.  unassembled code at any time by changing the mode to assembly or mixed (see
  8178.  Section 9.1, "Set Mode Command," for more information).
  8179.  
  8180.  Dialog
  8181.  
  8182.  To display unassembled code using a dialog command, enter a command line
  8183.  with the following syntax:
  8184.  
  8185.       U «address | range»
  8186.  
  8187.  The effect of the command varies depending on whether you are in sequential
  8188.  or window mode.
  8189.  
  8190.  In sequential mode, if you do not specify address or range, the disassembled
  8191.  code begins at the current unassemble address and shows the next eight lines
  8192.  of instructions. The unassemble address is the address of the instruction
  8193.  after the last instruction displayed by the previous Unassemble command. If
  8194.  the Unassemble command has not been used during the session, the unassemble
  8195.  address is the current instruction.
  8196.  
  8197.  If you specify an address, the disassembly starts at that address and shows
  8198.  the next eight lines of instructions. If you specify a range, the
  8199.  instructions within the range will be displayed.
  8200.  
  8201.  The sequential mode format of the display depends on the current display
  8202.  mode (see Section 9.1, "Set Mode Command," for more information). If the
  8203.  mode is source (S+) or mixed (S&), the CodeView debugger displays source
  8204.  lines mixed with unassembled instructions. One source line is shown for each
  8205.  corresponding group of assembly-language instructions. If the display mode
  8206.  is assembly, only assembly-language instructions are shown.
  8207.  
  8208.  In window mode, the Unassemble command changes the mode of the display
  8209.  window to assembly. The display format will reflect any options previously
  8210.  set from the Options menu. There is no output to the dialog window. If
  8211.  address is given, the instructions in the display window will begin at the
  8212.  specified address. If range is given, only the starting address will be
  8213.  used. If no argument is given, the debugger scrolls down and displays the
  8214.  next screen of assembly-language instructions.
  8215.  
  8216.  ───────────────────────────────────────────────────────────────────────────
  8217.  NOTE
  8218.     The 80286 protected-mode mnemonics (also available with the 80386) cannot
  8219.     be displayed with the Unassemble command.
  8220.  ───────────────────────────────────────────────────────────────────────────
  8221.  
  8222.  Examples
  8223.  
  8224.       >S&
  8225.       mixed
  8226.       >U 0x11
  8227.       49D0:0011 35068E       XOR   AX,__sqrtjmptab+8cd4 (8E06)
  8228.       49D0:0014 189A2300     SBB   Byte Ptr [BP+SI+0023],BL
  8229.       49D0:0018 FC           CLD
  8230.       49D0:0019 49           DEC   CX
  8231.       49D0:001A CD351ED418   INT   35 ;FSTP    DWord Ptr [__fpinit+ee (18D4)]
  8232.       49D0:001F CD3D         INT   3D ;FWAIT
  8233.       7:           A = 0.0
  8234.       49D0:0021 CD35EE       INT   35 ;FLDZ
  8235.  
  8236.  The sequential mode example above sets the mode to mixed and unassembles
  8237.  eight lines of machine code, plus whatever source lines are encountered
  8238.  within those lines. The display would be the same if the mode were source.
  8239.  
  8240.  The example is taken from a FORTRAN debugging session, but produces results
  8241.  similar to what would be produced using the same commands with a C or BASIC
  8242.  program.
  8243.  
  8244.       >S-
  8245.       assembly
  8246.       >U 0x11
  8247.       49D0:0011 35068E       XOR   AX,__sqrtjmptab+8cd4 (8E06)
  8248.       49D0:0014 189A2300     SBB   Byte Ptr [BP+SI+0023],BL
  8249.       49D0:0018 FC           CLD
  8250.       49D0:0019 49 DEC       CX
  8251.       49D0:001A CD351ED418   INT   35 ;FSTP    DWord Ptr [__fpinit+ee (18D4)]
  8252.       49D0:001F CD3D         INT   3D ;FWAIT
  8253.       49D0:0021 CD35EE       INT   35 ;FLDZ
  8254.       >
  8255.  
  8256.  The sequential mode example above sets the mode to assembly and repeats the
  8257.  same command.
  8258.  
  8259.  
  8260.  9.3  View Command
  8261.  
  8262.  The View command displays the lines of a text file (usually a source module
  8263.  or include file). It is most useful in sequential mode where it is the only
  8264.  method of examining a sequence of source lines. In window mode the View
  8265.  command can be used to page through the source file or to load a new source
  8266.  file.
  8267.  
  8268.  Mouse
  8269.  
  8270.  To load a new source file with the button, point to File on the menu bar,
  8271.  press a mouse button and drag the highlight to the Load selection, then
  8272.  release the button. A dialog box appears, asking for the name of the file
  8273.  you wish to load. Type the name of the file, and press ENTER or a mouse
  8274.  button. The new file appears in the display window.
  8275.  
  8276.  The paging capabilities of the View command have no direct mouse equivalent,
  8277.  but you can move about in the source file by pointing to the up or down
  8278.  arrows on the scroll bars and then clicking different mouse buttons. See
  8279.  Section 2.1.2.2, "Controlling Program Execution with the Mouse," for more
  8280.  information.
  8281.  
  8282.  Keyboard
  8283.  
  8284.  To load a new source file with a keyboard command, press ALT+F to open the
  8285.  File menu, then press L to select Load. A dialog box appears, asking for the
  8286.  name of the file you wish to load. Type the name of the file, and press
  8287.  ENTER. The new file appears in the display window.
  8288.  
  8289.  The paging capabilities of the View command have no direct keyboard
  8290.  equivalent, but you can move about in the source file by first putting the
  8291.  cursor in the display window with the F6 key, then pressing the PGUP, PGDN,
  8292.  HOME, END,
  8293.  
  8294.  UP ARROW, and DOWN ARROW keys. See Section 2.1.1.3, "Controlling Program
  8295.  Execution with Keyboard Commands," for more information.
  8296.  
  8297.  Dialog
  8298.  
  8299.  To display source lines using a dialog command, enter a command line with
  8300.  the following syntax:
  8301.  
  8302.       V «expression»
  8303.  
  8304.  Since addresses for the View command are often specified as a line number
  8305.  (with an optional source file), a more specific syntax for the command would
  8306.  be as follows:
  8307.  
  8308.       V «.«filename:»linenumber»
  8309.  
  8310.  The effect of the command varies, depending on whether you are in sequential
  8311.  or window mode.
  8312.  
  8313.  In sequential mode, the View command displays eight source lines. The
  8314.  starting source line is one of the following:
  8315.  
  8316.    ■  The current source line if no argument is given.
  8317.  
  8318.    ■  The specified linenumber. If filename is given, the specified file is
  8319.       loaded, and the linenumber refers to lines in it.
  8320.  
  8321.    ■  The address that expression evaluates to. For example, expression could
  8322.       be a procedure name or an address in the segment:offset format. The
  8323.       code segment is assumed if no segment is given.
  8324.  
  8325.  In sequential mode, the View command is not affected by the current display
  8326.  mode (source, assembly, or mixed); source lines are displayed without regard
  8327.  to mode.
  8328.  
  8329.  In window mode, if you enter the View command while the display mode is
  8330.  assembly, the CodeView debugger will automatically switch back to source
  8331.  mode. If you give linenumber or expression, the display window will be
  8332.  redrawn so that the source line corresponding to the given address will
  8333.  appear at the top of the source window. If you specify a filename with a
  8334.  linenumber, the specified file will be loaded.
  8335.  
  8336.  If you enter the View command with no arguments, the display will scroll
  8337.  down one line short of a page; that is, the source line that was at the
  8338.  bottom of the window will be at the top.
  8339.  
  8340.  ───────────────────────────────────────────────────────────────────────────
  8341.  NOTE
  8342.     The View command with no argument is similar to pressing the PGDN key or
  8343.     clicking Right on the down arrow with the mouse. The difference is that
  8344.     pressing the PGDN key enables you to scroll down one more line.
  8345.  ───────────────────────────────────────────────────────────────────────────
  8346.  
  8347.  Examples
  8348.  
  8349.       >V BUBBLE       ;* Example 1, FORTRAN source code
  8350.       51:        IF (N .LE. 1) GOTO 101
  8351.       52:        DO 201 I = 1,N-1
  8352.       53:        DO 301 J = I + 1,N
  8353.       54:        IF (X(I) .LE. X(J)) GOTO 301
  8354.       55:        TEMP = X(I)
  8355.       56:        X(I) = X(J)
  8356.       57:        X(J) = TEMP
  8357.       58:    301 CONTINUE
  8358.  
  8359.  Example 1 (shown in sequential mode) displays eight source lines, beginning
  8360.  at routine BUBBLE.
  8361.  
  8362.       >V .math.c:30   ;* Example 2, C source code
  8363.       30:                register int j;
  8364.       31:
  8365.       32:                for (j = q; j >= 0; j--)
  8366.       33:                        if (t[j] + p[j] > 9) {
  8367.       34:                                p[j] += t[j] - 10;
  8368.       35:                                p[j-1] += 1;
  8369.       36:                        } else
  8370.       37:                                p[j] += t[j];
  8371.       >
  8372.  
  8373.  Example 2 loads the source file math.c and displays eight source lines
  8374.  starting at line 30.
  8375.  
  8376.  All forms of the View command are supported with all languages that work
  8377.  with the CodeView debugger.
  8378.  
  8379.  
  8380.  9.4  Current Location Command
  8381.  
  8382.  The Current Location command displays the source line or assembly-language
  8383.  instruction corresponding to the current program location.
  8384.  
  8385.  Mouse
  8386.  
  8387.  The Current Location command cannot be executed with the mouse.
  8388.  
  8389.  Keyboard
  8390.  
  8391.  The Current Location command cannot be executed with a keyboard command.
  8392.  
  8393.  Dialog
  8394.  
  8395.  To display the current location line using a dialog command, enter a command
  8396.  line with the following syntax (a period only):
  8397.  
  8398.       .
  8399.  
  8400.  In sequential mode, the command displays the current source line. The line
  8401.  is displayed regardless of whether the current debugging mode is source or
  8402.  assembly. If the program being debugged has no symbolic information, the
  8403.  command will be ignored.
  8404.  
  8405.  In window mode, the command puts the current program location (marked with
  8406.  reverse video or a contrasting color) in the center of the display window.
  8407.  The display mode (source or assembly) will not be affected. This command is
  8408.  useful if you have scrolled through the source code or assembly-language
  8409.  instructions so that the current location line is no longer visible.
  8410.  
  8411.  For example, if you are in window mode and have executed the program being
  8412.  debugged to somewhere near the start of the program, but you have scrolled
  8413.  the display to a point near the end, the Current Location command returns
  8414.  the display to the current program location.
  8415.  
  8416.  Example
  8417.  
  8418.       >.
  8419.       MINDAT = 1.0E6
  8420.       >
  8421.  
  8422.  The example above illustrates how to display the current source line in
  8423.  sequential mode. The same command in window mode would not produce any
  8424.  output, but it could change the text that is shown in the display window.
  8425.  
  8426.  
  8427.  9.5  Stack Trace Command
  8428.  
  8429.  The Stack Trace command allows you to display routines that have been called
  8430.  during program execution (see note below). The first line of the display
  8431.  shows the name of the current routine. The succeeding lines (if any) list
  8432.  any other routines that were called to reach the current address. The dialog
  8433.  version of the Stack Trace command also displays the source lines where each
  8434.  routine was called.
  8435.  
  8436.  For each routine, the values of any arguments are shown in parentheses after
  8437.  the routine name. Values are shown in the current radix (the default is
  8438.  decimal).
  8439.  
  8440.  The term "stack trace" is used because as each routine is called, its
  8441.  address and arguments are stored on (pushed onto) the program stack.
  8442.  Therefore, tracing through the stack shows the currently active routines.
  8443.  With C and FORTRAN programs, the main routine will always be at the bottom
  8444.  of the stack. With BASIC programs, the main program is not listed on the
  8445.  stack because BASIC programs have no standard label (such as main)
  8446.  corresponding to the first line of a program. Only routines called by the
  8447.  main program will be displayed. In assembly-language programs, the bottom
  8448.  routine displayed in the stack trace is astart instead of main.
  8449.  
  8450.  ───────────────────────────────────────────────────────────────────────────
  8451.  NOTE
  8452.     This discussion uses the term "routines," which is a general term for
  8453.     functions (C, FORTRAN, Pascal), subroutines (FORTRAN), procedures
  8454.     (Pascal), and subprograms and function procedures (BASIC)──each of which
  8455.     uses the stack to transfer control to an independent program unit. In
  8456.     assembly mode, the term "procedure" may be more accurate. GOSUB and DEF
  8457.     FN routines in BASIC will not work with the Stack Trace command, since
  8458.     they do not follow the same convention for setting up the stack.
  8459.     If you are using the CodeView debugger to debug assembly-language
  8460.     programs, the Stack Trace command will work only if procedures were
  8461.     called with the calling convention used by Microsoft languages. This
  8462.     calling convention is explained in the Microsoft Mixed-Language
  8463.     Programming Guide.
  8464.  ───────────────────────────────────────────────────────────────────────────
  8465.  
  8466.  The Stack Trace command does not work reliably until you execute at least to
  8467.  the beginning of the main procedure. The main procedure sets up the frame
  8468.  pointer (BP), which CodeView uses to locate parameters, local variables, and
  8469.  return addresses. If your main module is written in assembly, you must
  8470.  execute at least to the beginning of the first procedure called.
  8471.  Furthermore, your procedures must follow the standard Microsoft calling
  8472.  conventions.
  8473.  
  8474.  Mouse
  8475.  
  8476.  To view a stack trace with the mouse, point to Calls on the menu bar and
  8477.  press a mouse button. The Calls menu will appear, showing the current
  8478.  routine at the top and other routines below it in the reverse order in which
  8479.  they were called; for example, the first routine called (which is always
  8480.  main in a C or FORTRAN program) will be at the bottom. The values of any
  8481.  routine arguments will be shown in parentheses following the routines.
  8482.  
  8483.  If you want to view one of the routines that was previously called, select
  8484.  the routine by dragging down the highlight to the routine you wish to see,
  8485.  then releasing the mouse button. (You can also select a routine by clicking
  8486.  a selection once the menu is open.) The effect of selecting a routine in the
  8487.  Calls menu is to cause the debugger to display that routine. The cursor will
  8488.  be on the last statement executed in the routine.
  8489.  
  8490.  Keyboard
  8491.  
  8492.  To view a stack trace with a keyboard command, press ALT+C to open the Calls
  8493.  menu. The menu will show the current routine at the top and other routines
  8494.  below it in the reverse order in which they were called; for example, the
  8495.  first routine called will be at the bottom. The values of any routine
  8496.  arguments will be shown in parentheses following the routine.
  8497.  
  8498.  If you want to view one of the routines that was previously called, select
  8499.  the routine by moving the cursor with the arrow keys and then pressing
  8500.  ENTER, or by typing the number or letter to the left of the routine. The
  8501.  effect of selecting a routine in the Calls menu is to cause the debugger to
  8502.  display that routine. The cursor will be on the last statement that was
  8503.  executed in the routine.
  8504.  
  8505.  Dialog
  8506.  
  8507.  To display a stack trace with a dialog command, enter a command line with
  8508.  the following syntax:
  8509.  
  8510.       K
  8511.  
  8512.  The output from the Stack Trace dialog command lists the routines in the
  8513.  reverse order in which they were called. The arguments to each routine are
  8514.  shown in parentheses. Finally, the line number from which the routine was
  8515.  called is shown.
  8516.  
  8517.  You can enter the line number as an argument to the View or Unassemble
  8518.  command if you want to view code at the point where the routine was called.
  8519.  
  8520.  In window mode, the output from the Stack Trace dialog command appears in
  8521.  the dialog window.
  8522.  
  8523.  FORTRAN Example
  8524.  
  8525.       >K
  8526.       ANALYZE(67,0), line 94
  8527.       COUNTWORDS(0,512), line 73
  8528.       MAIN(2,5098), line 42
  8529.       >
  8530.  
  8531.  In the example above, the first line of output indicates that the current
  8532.  routine is ANALYZE. Its first argument currently has a decimal value of 67,
  8533.  and its second argument, a value of 0. The current location in this routine
  8534.  is line 94.
  8535.  
  8536.  The second line indicates that ANALYZE was called by COUNTWORDS, and that
  8537.  its arguments have the values 0 and 512. Routine ANALYZE was called from
  8538.  line 73 of routine COUNTWORDS.
  8539.  
  8540.  Likewise, COUNTWORDS was called from line 42 of MAIN, and its arguments
  8541.  have the values 2 and 5098.
  8542.  
  8543.  If the radix had been set to 16 or 8 using the Radix (N) command, the
  8544.  arguments would be shown in that radix. For example, the last line would be
  8545.  shown as MAIN( 2,13ea ) in hexadecimal or MAIN( 2,11752 ) in octal.
  8546.  
  8547.  C Example
  8548.  
  8549.       >K
  8550.       analyze(67,0), line 94
  8551.       countwords(0,512), line 73
  8552.       main(2,5098)
  8553.       >
  8554.  
  8555.  As with the FORTRAN example, the example above shows the routines on the
  8556.  stack in the reverse order in which they were called. Since analyze is on
  8557.  the top, it has been called most recently; in other words, it is the current
  8558.  routine.
  8559.  
  8560.  Each routine is shown with the arguments it was passed, along with the last
  8561.  source line that it had been executing. Note that main is shown with the
  8562.  command line arguments argc (which is equal to 2) and argv (which is a
  8563.  pointer equal to 5,098 decimal). Since the language is C, main will always
  8564.  be on the bottom of the stack.
  8565.  
  8566.  BASIC Example
  8567.  
  8568.       >K
  8569.       ROLL#(19122:6040)
  8570.       MAKE#(19122:6040)
  8571.       CALC(19122:5982, 19122:5990)
  8572.       >
  8573.  
  8574.  As with the FORTRAN example, the example above shows the routines on the
  8575.  stack in the reverse order in which they were called. Since ROLL# is on the
  8576.  top, it has been called most recently; in other words, it is the current
  8577.  routine.
  8578.  
  8579.  Each routine is displayed along with the arguments by which it was passed.
  8580.  In BASIC, arguments passed to routines are always addresses.
  8581.  
  8582.  This example shows some features peculiar to BASIC. First of all, there is
  8583.  no MAIN displayed because the BASIC compiler does not produce any such
  8584.  symbol. Furthermore, each routine will have a type tag if it is a function;
  8585.  the tag indicates what the function returns. ROLL# and MAKE# are both
  8586.  functions returning a double-precision floating point. A function that
  8587.  returned a short integer would have a % type tag. CALC has no type tag since
  8588.  it is a sub-program, and therefore does not return a value of any type.
  8589.  
  8590.  
  8591.  Chapter 10  Modifying Code or Data
  8592.  ───────────────────────────────────────────────────────────────────────────
  8593.  
  8594.  The CodeView debugger provides the following commands for modifying code or
  8595.  data in memory:
  8596.  
  8597.  Command                     Action
  8598.  
  8599.  Assemble (A)                Modifies code
  8600.  
  8601.  Enter (E)                   Modifies memory, usually data
  8602.  
  8603.  Register (R)                Modifies registers and flags
  8604.  
  8605.  Fill Memory (F)             Fills a block of memory
  8606.  
  8607.  Move Memory (M)             Copies one block of memory to another
  8608.  
  8609.  Port Output (O)             Outputs a byte to a hardware port
  8610.  
  8611.  These commands change code temporarily. You can use the alterations for
  8612.  testing in the CodeView debugger, but you cannot save them or permanently
  8613.  change the program. To make permanent changes, you must modify the source
  8614.  code and recompile.
  8615.  
  8616.  
  8617.  10.1  Assemble Command
  8618.  
  8619.  The Assemble command assembles 8086-family (8086, 8087, 8088, 80186, 80286,
  8620.  80287, and 80286 and 80386 unprotected) instruction mnemonics and places the
  8621.  resulting instruction code into memory at a specified address. The only
  8622.  8086-family mnemonics that cannot be assembled are 80286 protected-mode
  8623.  mnemonics. In addition, the debugger will also assemble 80286 instructions
  8624.  that utilize the expanded 386 registers.
  8625.  
  8626.  ───────────────────────────────────────────────────────────────────────────
  8627.  NOTE
  8628.     The effects of the Assemble command are temporary. Any instructions that
  8629.     you assemble are lost as soon as you exit the program.
  8630.  
  8631.     The instructions you assemble are also lost when you restart the program
  8632.     with the Start or Restart command because the original code is reloaded
  8633.     on top of memory you may have altered.
  8634.  
  8635.     To test the results of an Assemble command, you may need to manipulate
  8636.     the IP register (and possibly the CS register) to the starting address
  8637.     of the instructions you have assembled. If you do this, you must use the
  8638.     Current Line command (.) to reset the debugger's internal variables so
  8639.     that it will trace properly.
  8640.  ───────────────────────────────────────────────────────────────────────────
  8641.  
  8642.  Mouse
  8643.  
  8644.  The Assemble command cannot be executed with the mouse.
  8645.  
  8646.  Keyboard
  8647.  
  8648.  The Assemble command cannot be executed with a keyboard command.
  8649.  
  8650.  Dialog
  8651.  
  8652.  To assemble code using a dialog command, enter a command line with the
  8653.  following syntax:
  8654.  
  8655.       A «address»
  8656.  
  8657.  If address is specified, the assembly starts at that address; otherwise the
  8658.  current assembly address is assumed.
  8659.  
  8660.  The assembly address is normally the current address (the address pointed to
  8661.  by the CS and IP registers). However, when you use the Assemble command, the
  8662.  assembly address is set to the address immediately following the last
  8663.  assembled instruction. When you enter any command that executes code (Trace,
  8664.  Program Step, Go, or Execute), the assembly address is reset to the current
  8665.  address.
  8666.  
  8667.  When you type the Assemble command, the assembly address is displayed. The
  8668.  CodeView debugger then waits for you to enter a new instruction in the
  8669.  standard 8086-family instruction-mnemonic form. You can enter instructions
  8670.  in uppercase, lowercase, or both.
  8671.  
  8672.  To assemble a new instruction, type the desired mnemonic and press ENTER.
  8673.  The CodeView debugger assembles the instruction into memory and displays the
  8674.  next available address. Continue entering new instructions until you have
  8675.  assembled all the instructions you want. To conclude assembly and return to
  8676.  the CodeView prompt, press ENTER only.
  8677.  
  8678.  If an instruction you enter contains a syntax error, the debugger displays
  8679.  the message ^ Syntax error, redisplays the current assembly address, and
  8680.  waits for you to enter a correct instruction. The caret symbol in the
  8681.  message will point to the first character the CodeView debugger could not
  8682.  interpret.
  8683.  
  8684.  The following eight principles govern entry of instruction mnemonics:
  8685.  
  8686.    1. The far-return mnemonic is RETF.
  8687.  
  8688.    2. String mnemonics must explicitly state the string size. For example,
  8689.       MOVSW must be used to move word strings, and MOVSB must be used to move
  8690.       byte strings.
  8691.  
  8692.    3. The CodeView debugger automatically assembles short, near, or far jumps
  8693.       and calls, depending on byte displacement to the destination address.
  8694.       These may be overridden with the NEAR or FAR prefix, as shown in the
  8695.       following examples:
  8696.  
  8697.          JMP     0x502
  8698.          JMP     NEAR 0x505
  8699.          JMP     FAR  0x50A
  8700.  
  8701.       The NEAR prefix can be abbreviated to NE, but the FAR prefix cannot be
  8702.       abbreviated. The examples above use the C notation for hexadecimal
  8703.       numbers. If the FORTRAN option were selected, you would enter the
  8704.       operands as #502, #505, and #50A; if the BASIC option were selected,
  8705.       you would enter them as &H502 , &H505, and &H50A.
  8706.  
  8707.    4. The CodeView debugger cannot determine whether some operands refer to a
  8708.       word memory location or to a byte memory location. In these cases, the
  8709.       data type must be explicitly stated with the prefix WORDPTR or BYTE
  8710.       PTR. Acceptable abbreviations are WO and BY. Examples are shown below:
  8711.  
  8712.          MOV     WORD PTR [BP],1
  8713.          MOV     BYTE PTR [SI-1],symbol
  8714.          MOV     WO PTR [BP],1
  8715.          MOV     BY PTR [SI-1],symbol
  8716.  
  8717.    5. The CodeView debugger cannot determine whether an operand refers to a
  8718.       memory location or to an immediate operand. The debugger uses the
  8719.       convention that operands enclosed in square brackets refer to memory.
  8720.       Two examples are shown below:
  8721.  
  8722.          MOV     AX,#21
  8723.          MOV     AX,[#21]
  8724.  
  8725.       The first statement moves 21 hexadecimal into AX. The second statement
  8726.       moves the data at offset 21 hexadecimal into AX. Both statements use
  8727.       the FORTRAN notation for the hexadecimal number 21. If the C option
  8728.       were selected, this number would be represented as 0x21, and if the
  8729.       BASIC option were selected, the number would be represented as &H21.
  8730.  
  8731.    6. The CodeView debugger  supports all forms of indirect register
  8732.       instructions, as shown in the following examples:
  8733.  
  8734.          ADD     BX,[BP+2].[SI-1]
  8735.          POP     [BP+DI]
  8736.          PUSH    [SI]
  8737.  
  8738.    7. All instruction-name synonyms are supported. If you assemble
  8739.       instructions and then examine them with the Unassemble command (U), the
  8740.       CodeView debugger may show synonymous instructions, rather than the
  8741.       ones you assembled, as shown in the following examples:
  8742.  
  8743.          LOOPZ   &H100
  8744.          LOOPE   &H100
  8745.          JA      &H200
  8746.          JNBE    &H200
  8747.  
  8748.       The examples above use the BASIC hexadecimal notation. Instead of using
  8749.       the &H prefix, you would use 0x with the C option selected, and # with
  8750.       the FORTRAN option selected.
  8751.  
  8752.    8. Do not assemble and execute 8087 or 80287 instructions if your system
  8753.       is not equipped with one of these math coprocessor chips. If you try to
  8754.       execute the WAIT instruction without the appropriate chip, for example,
  8755.       your system will crash.
  8756.  
  8757.  Example
  8758.  
  8759.       >U #40 L 1
  8760.       39B0:0040 89C3           MOV        BX,AX
  8761.       >A #40
  8762.       39B?0:0040 MOV     CX,AX
  8763.       39B0:0042
  8764.       >U #40 L 1
  8765.       39B0:0040 89C1           MOV        CX,AX
  8766.       >
  8767.  
  8768.  The example above (in FORTRAN notation) modifies the instruction at address
  8769.  40 hexadecimal so that it moves data into the CX register instead of the BX
  8770.  register (40 hexadecimal is notated as 0x40 in C, and as &H40 in BASIC). The
  8771.  Unassemble command (U) is used to show the instruction before and after the
  8772.  assembly.
  8773.  
  8774.  You can modify a portion of code for testing, as in the example, but you
  8775.  cannot save the modified program. You must modify your source code and
  8776.  recompile.
  8777.  
  8778.  
  8779.  10.2  Enter Commands
  8780.  
  8781.  The CodeView debugger has several commands for entering data to memory. You
  8782.  can use these commands to modify either code or data, though code can
  8783.  usually be modified more easily with the Assemble command (A). The Enter
  8784.  commands are listed below:
  8785.  
  8786.  Command                     Command Name
  8787.  
  8788.  E                           Enter (size is the default type)
  8789.  
  8790.  EB                          Enter Bytes
  8791.  
  8792.  EA                          Enter ASCII
  8793.  
  8794.  EI                          Enter Integers
  8795.  
  8796.  EU                          Enter Unsigned Integers
  8797.  
  8798.  EW                          Enter Words
  8799.  
  8800.  ED                          Enter Double Words
  8801.  
  8802.  ES                          Enter Short Reals
  8803.  
  8804.  EL                          Enter Long Reals
  8805.  
  8806.  ET                          Enter 10-Byte Reals
  8807.  
  8808.  Mouse
  8809.  
  8810.  The Enter commands cannot be executed with the mouse.
  8811.  
  8812.  Keyboard
  8813.  
  8814.  The Enter commands cannot be executed with keyboard commands.
  8815.  
  8816.  Dialog
  8817.  
  8818.  To enter data (or code) to memory with a dialog command, enter a command
  8819.  line with the following syntax:
  8820.  
  8821.       E«type» address «list»
  8822.  
  8823.  The type is a one-letter specifier that indicates the type of the data to be
  8824.  entered. The address indicates where the data will be entered. If no segment
  8825.  is given in the address, the data segment (DS) is assumed.
  8826.  
  8827.  The list can consist of one or more expressions that evaluate to data of the
  8828.  size specified by type (the expressions in the list are separated by
  8829.  spaces). This data will be entered to memory at address. If one of the
  8830.  values in the list is invalid, an error message will be displayed. The
  8831.  values preceding the error are entered; values at and following the error
  8832.  are not entered.
  8833.  
  8834.  The expressions in the list are evaluated in the current radix, regardless
  8835.  of the size and type of data being entered. For example, if the radix is 10
  8836.  and you give the value 10 in a list with the Enter Words command, the
  8837.  decimal value 10 will be entered even though word values are normally
  8838.  entered in hexadecimal. This means that the Enter Words, Enter Integers, and
  8839.  Enter Unsigned Integers commands are identical when used with the list
  8840.  method since two-byte data are being entered for each command.
  8841.  
  8842.  If list is not given, the CodeView debugger will prompt for values to be
  8843.  entered to memory. Values entered in response to prompts are accepted in
  8844.  hexadecimal for the Enter Bytes, Enter ASCII, Enter Words, and Enter Double
  8845.  Words commands. The Enter Integers command accepts signed decimal integers,
  8846.  while the Enter Unsigned Integers command accepts unsigned decimal integers.
  8847.  The Enter Short Reals, Enter Long Reals, and Enter 10-Byte Reals commands
  8848.  accept decimal floating-point values.
  8849.  
  8850.  With the prompting method of data entry, the CodeView debugger prompts for a
  8851.  new value at address by displaying the address and its current value. As
  8852.  explained below, you can then replace the value, skip to the next value,
  8853.  return to a previous value, or exit the command.
  8854.  
  8855.    1. To replace the value, type the new value after the current value.
  8856.  
  8857.    2. To skip to the next value, press the SPACEBAR. Once you have skipped to
  8858.       the next value, you can change its value or skip to the following
  8859.       value. If you pass the end of the display, the CodeView debugger
  8860.       displays a new address to start a new display line.
  8861.  
  8862.    3. To return to the preceding value, type a backslash (\). When you return
  8863.       to the preceding value, the debugger starts a new display line with the
  8864.       address and value.
  8865.  
  8866.    4. To stop entering values and return to the CodeView prompt, press ENTER.
  8867.       You can exit the command at any time.
  8868.  
  8869.  Sections 10.2.1-10.2.10 discuss the Enter commands in order of the size of
  8870.  
  8871.  data they accept.
  8872.  
  8873.  Examples
  8874.  
  8875.       >EW PLACE 16 32
  8876.  
  8877.  The example above shows how to enter two word-sized values at the PLACE
  8878.  address.
  8879.  
  8880.       >EW PLACE
  8881.  
  8882.       3DA5:0B20 00F3.
  8883.  
  8884.  The example above illustrates the prompting method of entering data. When
  8885.  you supply the address where you want to enter data but supply no data, the
  8886.  CodeView debugger displays the current value of the address and waits for
  8887.  you to enter a new value. The reverse-video space ( ) in this example and
  8888.  the examples below represents the CodeView cursor. You change the value F3
  8889.  to the new value 16 (10 hexadecimal) by typing 10 (without pressing ENTER
  8890.  yet). The value must be typed in hexadecimal for the Enter Words command,
  8891.  as shown below:
  8892.  
  8893.       >EW PLACE
  8894.  
  8895.       3DA5:0B20  00F3.10
  8896.  
  8897.  You can then skip to the next value by pressing the SPACEBAR. The CodeView
  8898.  debugger responds by displaying the next value, as shown below:
  8899.  
  8900.       >EW PLACE
  8901.  
  8902.       3DA5:0B20  00F3.10  4F20.
  8903.  
  8904.  You can then type another hexadecimal value, such as 30:
  8905.  
  8906.       >EW PLACE
  8907.  
  8908.       3DA5:0B20  00F3.10  4F20.30
  8909.  
  8910.  To move to the next value, press the SPACEBAR.
  8911.  
  8912.       >EW PLACE
  8913.  
  8914.       3DA5:0B20  00F3.10  4F20.30  3DC1.
  8915.  
  8916.  Assume you realize that the last value entered, 30, is incorrect. You really
  8917.  wanted to enter 20. You could return to the previous value by typing a
  8918.  backslash. The CodeView debugger starts a new line, starting with the
  8919.  previous value. Note that the backslash is not echoed on the screen:
  8920.  
  8921.       >EW PLACE
  8922.  
  8923.       3DA5:0B20  00F3.10  4F20.30  3DC1.
  8924.       3DA5:0B22  0030.
  8925.  
  8926.  Type the correct value, 20:
  8927.  
  8928.       >EW PLACE
  8929.  
  8930.       3DA5:0B20  00F3.10  4F20.30  3DC1.
  8931.       3DA5:0B22  0030.20
  8932.  
  8933.  If this is the last value you want to enter, press ENTER to stop. The
  8934.  CodeView prompt reappears, as shown below:
  8935.  
  8936.       >EW PLACE
  8937.  
  8938.       3DA5:0B20  00F3.10  4F20.30  3DC1.
  8939.       3DA5:0B22  0030.20
  8940.       >
  8941.  
  8942.  
  8943.  10.2.1  Enter Command
  8944.  
  8945.  Syntax
  8946.  
  8947.       E address«list»
  8948.  
  8949.  The Enter command enters one or more values into memory at the specified
  8950.  address. The data are entered in the format of the default type, which is
  8951.  the last type specified with a Dump, Enter, Watch Memory, or Tracepoint
  8952.  Memory command. If none of these commands has been entered during the
  8953.  session, the default type is bytes.
  8954.  
  8955.  Use this command with caution when entering values in the list format;
  8956.  values will be truncated if you enter a word-sized value when the default
  8957.  type is actually bytes. If you are not sure of the current default type,
  8958.  specify the size in the command.
  8959.  
  8960.  ───────────────────────────────────────────────────────────────────────────
  8961.  NOTE
  8962.     The Execute command and the Enter command have the same command letter
  8963.     (E). The difference is that the Execute command never takes an argument;
  8964.     the Enter command always requires at least one argument.
  8965.  ───────────────────────────────────────────────────────────────────────────
  8966.  
  8967.  
  8968.  10.2.2  Enter Bytes Command
  8969.  
  8970.  Syntax
  8971.  
  8972.       EB address«list»
  8973.  
  8974.  The Enter Bytes command enters one or more byte values into memory at
  8975.  address. The optional list can be entered as a list of expressions separated
  8976.  by spaces. The expressions are evaluated and entered in the current radix.
  8977.  If list is not given, the CodeView debugger prompts for new values that must
  8978.  be entered in hexadecimal.
  8979.  
  8980.  The Enter Bytes command can also be used to enter strings, as described in
  8981.  Section 10.2.3, "Enter ASCII Command."
  8982.  
  8983.  Examples
  8984.  
  8985.       >EB 256 10 20 30
  8986.       >
  8987.  
  8988.  If the current radix is 10, the above example replaces the three bytes at
  8989.  DS:256, DS:257, and DS:258 with the decimal values 10, 20, and 30. (These
  8990.  three bytes correspond to the hexadecimal addresses DS:0100, DS:0101, and
  8991.  DS:0102.)
  8992.  
  8993.       >EB 256
  8994.  
  8995.       3DA5:0100  130F.A
  8996.       >
  8997.  
  8998.  The example above replaces the byte at DS:256 (DS:0100 hexadecimal) with 10
  8999.  (0A hexadecimal).
  9000.  
  9001.  
  9002.  10.2.3  Enter ASCII Command
  9003.  
  9004.  Syntax
  9005.  
  9006.       EA address«list»
  9007.  
  9008.  The Enter ASCII command works in the same way as the Enter Bytes command
  9009.  (EB) described in Section 10.2.2 above. The list version of this command can
  9010.  be used to enter a string expression.
  9011.  
  9012.  Example
  9013.  
  9014.       >EA message "File cannot be found"
  9015.       >
  9016.  
  9017.  In the example above, the string File cannot be found is entered starting at
  9018.  the symbolic address message. (Note that the double quotation marks are
  9019.  CodeView string delimiters.)
  9020.  
  9021.  You can also use the Enter Bytes command to enter a string expression, or
  9022.  you can enter nonstring values using the Enter ASCII command.
  9023.  
  9024.  
  9025.  10.2.4  Enter Integers Command
  9026.  
  9027.  Syntax
  9028.  
  9029.       EI address«list»
  9030.  
  9031.  The Enter Integers command enters one or more word values into memory at
  9032.  address using the signed-integers format. With the CodeView debugger, a
  9033.  signed integer can be any decimal integer between -32,768 and 32,767.
  9034.  
  9035.  The optional list can be entered as a list of expressions separated by
  9036.  spaces. The expressions are entered and evaluated in the current radix. If
  9037.  list is not given, the CodeView debugger prompts for new values that must be
  9038.  entered in decimal.
  9039.  
  9040.  Examples
  9041.  
  9042.       >EI 256 -10 10 -20
  9043.       >
  9044.  
  9045.  If the current radix is 10, the example above replaces the three integers at
  9046.  DS:256, DS:258, and DS:260 with the decimal values -10, 10, and -20. (The
  9047.  three addresses correspond to the three hexadecimal addresses DS:0100,
  9048.  DS:0102, and DS:0104.)
  9049.  
  9050.       >EI 256
  9051.  
  9052.       3DA5:0100  130F.-10
  9053.       >
  9054.  
  9055.  The example above replaces the integer at DS:256 (hexadecimal address
  9056.  DS:0100) with -10.
  9057.  
  9058.  
  9059.  10.2.5  Enter Unsigned Integers Command
  9060.  
  9061.  Syntax
  9062.  
  9063.       EU address«list»
  9064.  
  9065.  The Enter Unsigned Integers command enters one or more word values into
  9066.  memory at address using the unsigned-integers format. With the CodeView
  9067.  debugger, an unsigned integer can be any decimal integer between 0 and
  9068.  65,535. The optional list can be entered as a list of expressions separated
  9069.  by spaces. The expressions are entered and evaluated in the current radix.
  9070.  If list is not given, the CodeView debugger prompts for new values that must
  9071.  be entered in decimal.
  9072.  
  9073.  Examples
  9074.  
  9075.       >EU 256 10 20 30
  9076.       >
  9077.  
  9078.  If the current radix is 10, the example above replaces the three unsigned
  9079.  integers at DS:256, DS:258, and DS:260 with the decimal values 10, 20, and
  9080.  30. (These addresses correspond to the hexadecimal addresses DS:0100,
  9081.  DS:0102, and DS:0104.)
  9082.  
  9083.       >EU 256
  9084.  
  9085.       3DA5:0100  130F.10
  9086.       >
  9087.  
  9088.  The example above replaces the integer at DS:256 (DS:0100 hexadecimal) with
  9089.  10.
  9090.  
  9091.  
  9092.  10.2.6  Enter Words Command
  9093.  
  9094.  Syntax
  9095.  
  9096.       EW address«list»
  9097.  
  9098.  The Enter Words command enters one or more word values into memory at
  9099.  address.
  9100.  
  9101.  The optional list can be entered as a list of expressions separated by
  9102.  spaces. The expressions are entered and evaluated in the current radix. If
  9103.  list is not given, CodeView prompts for new values that must be entered in
  9104.  hexadecimal.
  9105.  
  9106.  Examples
  9107.  
  9108.       >EW 256 10 20 30
  9109.       >
  9110.  
  9111.  If the current radix is 10, the example above replaces the three words at
  9112.  DS:256, DS:258, and DS:260 with the decimal values 10, 20, and 30. (These
  9113.  addresses correspond to the hexadecimal addresses DS:0100, DS:0102, and
  9114.  DS:0104.)
  9115.  
  9116.       >EW 256
  9117.  
  9118.       3DA5:0100  130F.A
  9119.       >
  9120.  
  9121.  The example above replaces the integer at DS:256 (DS:0100 hexadecimal) with
  9122.  10 (0A hexadecimal).
  9123.  
  9124.  
  9125.  10.2.7  Enter Double Words Command
  9126.  
  9127.  Syntax
  9128.  
  9129.       ED address«list»
  9130.  
  9131.  The Enter Double Words command enters one or more double-word values into
  9132.  memory at address. Double words are displayed and entered in the address
  9133.  
  9134.  format segment:offset──that is, two words separated by a colon (:). If the
  9135.  colon is omitted and only one word entered, only the offset portion of the
  9136.  address will be changed.
  9137.  
  9138.  The optional list can be entered as a list of expressions separated by
  9139.  spaces. The expressions are entered and evaluated in the current radix. If
  9140.  list is not given, CodeView prompts for new values that must be entered in
  9141.  hexadecimal.
  9142.  
  9143.  Examples
  9144.  
  9145.       >ED 256 8700:12008
  9146.       >
  9147.  
  9148.  If the current radix is 10, the example above replaces the double words at
  9149.  DS:256 (DS:0100 hexadecimal) with the decimal address 8700:12008
  9150.  (hexadecimal address 21FC:2EE8).
  9151.  
  9152.       >ED 256
  9153.  
  9154.       3DA5:0100  21FC:2EE8.2EE9
  9155.       >
  9156.  
  9157.  The example above replaces the offset portion of the double word at DS:256
  9158.  (DS:0100 hexadecimal) with 2EE9 hexadecimal. Since the segment portion of
  9159.  the address is not provided, the existing segment (21FC hexadecimal) is
  9160.  unchanged.
  9161.  
  9162.  
  9163.  10.2.8  Enter Short Reals Command
  9164.  
  9165.  Syntax
  9166.  
  9167.       ES address«list»
  9168.  
  9169.  The Enter Short Reals command enters one or more short-real values into
  9170.  memory at address.
  9171.  
  9172.  The optional list can be entered as a list of real numbers separated by
  9173.  spaces. The numbers must be entered in decimal, regardless of the current
  9174.  radix. If list is not given, the CodeView debugger prompts for new values
  9175.  that must be entered in decimal. Short-real numbers can be entered either in
  9176.  floating-point format or in scientific-notation format.
  9177.  
  9178.  Examples
  9179.  
  9180.       >ES 256 23.479 1/4 -1.65E+4 235
  9181.       >
  9182.  
  9183.  The example above replaces the four numbers at DS:256, DS:260, DS:264, and
  9184.  DS:268 with the real numbers 23.479, 0.25, -1650.0, and 235.0. (These
  9185.  addresses correspond to the hexadecimal addresses DS:0100, DS:0104, DS:0108,
  9186.  and DS:0112.)
  9187.  
  9188.       >ES PI
  9189.       3DA5:0064  42 79 74 65   7.215589E+022  3.141593
  9190.       >
  9191.  
  9192.  The example above replaces the number at the symbolic address PI with
  9193.  3.141593.
  9194.  
  9195.  
  9196.  10.2.9  Enter Long Reals Command
  9197.  
  9198.  Syntax
  9199.  
  9200.       EL address«list»
  9201.  
  9202.  The Enter Long Reals command enters one or more long-real values into memory
  9203.  at address.
  9204.  
  9205.  The optional list can be entered as a list of real numbers separated by
  9206.  spaces. The numbers must be entered in decimal, regardless of the current
  9207.  radix. If list is not given, the CodeView debugger prompts for new values
  9208.  that must be entered in decimal. Long-real numbers can be entered either in
  9209.  floating-point format or in scientific-notation format.
  9210.  
  9211.  Examples
  9212.  
  9213.       >EL 256 23.479 1/4 -1.65E+4 235
  9214.       >
  9215.  
  9216.  The example above replaces the four numbers at DS:256, DS:264, DS:272, and
  9217.  DS:280 with the real numbers 23.479, 0.25, -1650.0, and 235.0 . (These
  9218.  addresses correspond to the hexadecimal addresses DS:0100, DS:0108, DS:0110,
  9219.  and DS:0118.)
  9220.  
  9221.       >EL PI
  9222.       3DA5:0064  42 79 74 65 DC OF 49 40   5.012391E+001  3.141593
  9223.       >
  9224.  
  9225.  The example above replaces the number at the symbolic address PI with
  9226.  3.141593.
  9227.  
  9228.  
  9229.  10.2.10  Enter 10-Byte Reals Command
  9230.  
  9231.  Syntax
  9232.  
  9233.       ET address«list»
  9234.  
  9235.  The Enter 10-Byte Reals command enters one or more 10-byte-real values into
  9236.  memory at address.
  9237.  
  9238.  The optional list can be entered as a list of real numbers separated by
  9239.  spaces. The numbers must be entered in decimal, regardless of the current
  9240.  radix. If list is not given, the CodeView debugger prompts for new values
  9241.  that must be entered in decimal. The numbers can be entered either in
  9242.  floating-point format or in scientific-notation format.
  9243.  
  9244.  Examples
  9245.  
  9246.       >ET 256 23.479 1/4 -1.65E+4 235
  9247.       >
  9248.  
  9249.  The example above replaces the four numbers at DS:256, DS:266, DS:276, and
  9250.  DS:286 with the real numbers 23.479, 0.25, -1650.0, and 235.0. (These
  9251.  addresses correspond to the hexadecimal addresses DS:0100, DS:010A, DS:0114,
  9252.  and DS:011E.)
  9253.  
  9254.  
  9255.       >ET PI
  9256.       3DA5:0064  42 79 74 65 DC 0F 49 40 7F BD  -3.292601E-193  3.141593
  9257.       >
  9258.  
  9259.  The example above replaces the number at the symbolic address PI with
  9260.  3.141593.
  9261.  
  9262.  
  9263.  10.3  Fill Memory Command
  9264.  
  9265.  The Fill Memory command provides an efficient way of filling up a large or
  9266.  small block of memory with any values you specify. It is primarily of
  9267.  interest to assembly programmers because the command enters values directly
  9268.  into memory. However, you may find it useful for initializing large data
  9269.  areas such as an array or structure.
  9270.  
  9271.  You can enter arguments to the Fill Memory command using any radix.
  9272.  
  9273.  Mouse
  9274.  
  9275.  The Fill Memory command cannot be executed with a mouse.
  9276.  
  9277.  Keyboard
  9278.  
  9279.  The Fill Memory command cannot be executed with a keyboard command.
  9280.  
  9281.  Dialog
  9282.  
  9283.  To fill an area of memory with values you specify, enter the Fill Memory
  9284.  command as follow:
  9285.  
  9286.       F range list
  9287.  
  9288.  The Fill Memory command fills the addresses in the specified range with the
  9289.  byte values specified in list. The values in the list are repeated until the
  9290.  whole range is filled. (Thus, if you specify only one value, the entire
  9291.  range is filled with that same value.) If the list has more values than the
  9292.  number of bytes in the range, the command ignores any extra values.
  9293.  
  9294.  Examples
  9295.  
  9296.       >F 100 L 100 0   ;* hexadecimal radix assumed
  9297.       >
  9298.  
  9299.  The first example fills 255 (100 hexadecimal) bytes of memory starting at
  9300.  DS:0100 with the value 0. This command could be used to reinitialize the
  9301.  program's data without having to restart the program.
  9302.  
  9303.       >F table L 64 42 79 74 ;* hexadecimal radix assumed
  9304.       >
  9305.  
  9306.  The second example fills the 100 (64 hexadecimal) bytes starting at table
  9307.  with the following hexadecimal byte values: 42, 79, 74. These three values
  9308.  are repeated until all 100 bytes are filled.
  9309.  
  9310.  
  9311.  10.4  Move Memory Command
  9312.  
  9313.  The Move Memory command enables you to copy all the values in one block of
  9314.  memory directly to another block of memory of the same size. This command is
  9315.  of most interest to assembly programmers, but it can be used by anyone who
  9316.  wants to do large data transfers. For example, you can use this command to
  9317.  copy all the values in one array to the elements of another.
  9318.  
  9319.  Mouse
  9320.  
  9321.  The Move Memory command cannot be executed with the mouse.
  9322.  
  9323.  Keyboard
  9324.  
  9325.  The Move Memory command cannot be executed with a keyboard command.
  9326.  
  9327.  Dialog
  9328.  
  9329.  To copy the values in one block of memory to another, enter the Move Memory
  9330.  command with the following syntax:
  9331.  
  9332.       M range address
  9333.  
  9334.  The values in the block of memory specified by range are copied to a block
  9335.  of the same size beginning at address. All data in range are guaranteed to
  9336.  be copied completely over to the destination block, even if the two blocks
  9337.  overlap. However, if they do overlap, some of the original data in range
  9338.  will be altered.
  9339.  
  9340.  To prevent loss of data, the Move Memory command copies data starting at the
  9341.  source block's lowest address whenever the source is at a higher address
  9342.  than the destination. If the source is at a lower address, the Move Memory
  9343.  command copies data beginning at the source block's highest address.
  9344.  
  9345.  Example
  9346.  
  9347.       >M arr1(1) L arsize arr2(1)  ;* FORTRAN example
  9348.       >
  9349.  
  9350.  In the example above, the block of memory beginning with the first element
  9351.  of arr1 and arsize bytes long is copied directly to a block of the same size
  9352.  beginning at the address of the first element of arr2. In C, this command
  9353.  would be entered as M arr1[0] L arsize arr2[0].
  9354.  
  9355.  
  9356.  10.5  Port Output Command
  9357.  
  9358.  The Port Output command sends specific byte values to hardware ports. It is
  9359.  primarily of use to assembly programmers writing code that interacts
  9360.  directly with hardware.
  9361.  
  9362.  Mouse
  9363.  
  9364.  The Port Output command cannot be executed with a mouse.
  9365.  
  9366.  Keyboard
  9367.  
  9368.  The Port Output command cannot be executed with a keyboard command.
  9369.  
  9370.  Dialog
  9371.  
  9372.  To output to a hardware port, enter the Port Output command with the
  9373.  following syntax:
  9374.  
  9375.       O port byte
  9376.  
  9377.  The specified byte is sent to the specified port in which port is a 16-bit
  9378.  port address.
  9379.  
  9380.  Example
  9381.  
  9382.       >O 2F8 4F      ;* hexadecimal system radix assumed
  9383.       >
  9384.  
  9385.  The byte value 4F hexadecimal is sent to output port 2F8.
  9386.  
  9387.  The example above assumes that the system radix is hexadecimal. However (as
  9388.  with all other CodeView commands), you can enter the Port Output command
  9389.  using any radix you prefer. Both the port and byte arguments assume system
  9390.  radix unless you specify a radix override.
  9391.  
  9392.  The Port Output command is often used in conjunction with the Port Input
  9393.  command discussed in Section 6.7.
  9394.  
  9395.  
  9396.  10.6  Register Command
  9397.  
  9398.  The Register command has two functions: it displays the contents of the
  9399.  central processing unit registers and it changes the values of those
  9400.  registers. The modification features of the command are explained in this
  9401.  section. The display features of the Register command are explained in
  9402.  Section 6.8.
  9403.  
  9404.  Mouse
  9405.  
  9406.  The only register that can be changed with the mouse is the flags register.
  9407.  The register's individual bits (called flags) can be set or cleared. To
  9408.  change a flag, first make sure the register window is open. The window can
  9409.  be opened by selecting Registers from the Options menu or by pressing F2.
  9410.  
  9411.  The flag values are shown as mnemonics in the bottom of the window. Point to
  9412.  the flag you want to change and click either button. The mnemonic word
  9413.  representing the flag value will change. The mnemonics for each flag are
  9414.  shown in the second and third columns of Table 10.1 below. The color or
  9415.  highlighting of the flag will also be reversed when you change a flag. Set
  9416.  flags are shown in red on color monitors and in high-intensity text on
  9417.  two-color monitors. Cleared flags are shown in light blue on color monitors
  9418.  or normal text on two-color monitors.
  9419.  
  9420.  Keyboard
  9421.  
  9422.  The registers cannot be changed with keyboard commands.
  9423.  
  9424.  Dialog
  9425.  
  9426.  To change the value of a register with a dialog command, enter a command
  9427.  line with the following syntax:
  9428.  
  9429.       R «registername««=»expression»»
  9430.  
  9431.  To modify the value in a register, type the command letter R followed by
  9432.  registername. The CodeView debugger displays the current value of the
  9433.  register and prompts for a new value. Press ENTER if you only want to
  9434.  examine the value. If you want to change it, type an expression for the new
  9435.  value and press ENTER.
  9436.  
  9437.  As an alternative, you can type both registername and expression in the same
  9438.  command. You can use the equal sign (=) between registername and expression,
  9439.  but a space has the same effect.
  9440.  
  9441.  The register name can be any of the following: AX, BX, CX, DX, CS, DS, SS,
  9442.  ES, SP, BP, SI, DI, IP, or F (for flags). If you have a 386-based machine
  9443.  and have turned the 386 option on, the register name can be one of the
  9444.  32-bit register names shown in table 4.9.
  9445.  
  9446.  To change a flag value, supply the register name F when you enter the
  9447.  Register command. The command displays the value of each flag as a
  9448.  two-letter name.
  9449.  
  9450.  At the end of the list of values, the command displays a dash (-). Enter new
  9451.  values after the dash for the flags you wish to change, then press ENTER.
  9452.  You can enter flag values in any order. Flags for which new values are not
  9453.  entered remain unchanged. If you do not want to change any flags, press
  9454.  ENTER.
  9455.  
  9456.  If you enter an illegal flag name, an error message is displayed. The flags
  9457.  preceding the error are changed; flags at and following the error are not
  9458.  changed.
  9459.  
  9460.  The flag values are shown in Table 10.1.
  9461.  
  9462.  Table 10.1  Flag-Value Mnemonics
  9463.  
  9464.  Flag Name                Set    Clear
  9465.  
  9466.  Overflow                 OV     NV
  9467.  Direction                DN     UP
  9468.  Interrupt                EI     DI
  9469.  Sign                     NG     PL
  9470.  Zero                     ZR     NZ
  9471.  Auxiliary carry          AC     NA
  9472.  Parity                   PE     PO
  9473.  Carry                    CY     NC
  9474.  
  9475.  
  9476.  Examples
  9477.  
  9478.       >R IP 256
  9479.       >
  9480.  
  9481.  The example above changes the IP register to the value 256 (0100
  9482.  hexadecimal).
  9483.  
  9484.       >R AX
  9485.       AX OEOO
  9486.       :
  9487.  
  9488.  The example above displays the current value of the AX register and prompts
  9489.  for a new value (the reverse-video space ( ) represents the CodeView
  9490.  cursor). You can now type any 16-bit value after the colon.
  9491.  
  9492.       >R AX
  9493.       AX 0E00
  9494.       :256
  9495.       >
  9496.  
  9497.  The example above changes the value of AX to 256 (in the current radix).
  9498.  
  9499.       >R F UP EI PL
  9500.  
  9501.  The example above shows the command-line method of changing flag values.
  9502.  
  9503.       >R F
  9504.       NV(OV) UP(DN) EI(DI) PL(NG) NZ(ZR) AC(NA) PE(PO) NC(CY) -OV DI ZR
  9505.       >R F
  9506.       OV(NV) UP(DN) DI(EI) PL(NG) ZR(NZ) AC(NA) PE(PO) NC(CY) -
  9507.       >
  9508.  
  9509.  With the prompting method of changing flag values (shown above), the first
  9510.  mnemonic for each flag is the current value, and the second mnemonic (in
  9511.  parentheses) is the alternate value. You can enter one or more mnemonics at
  9512.  the dash prompt. In the example, the command is given a second time to show
  9513.  the results of the first command.
  9514.  
  9515.  
  9516.  Chapter 11  CodeView Control Commands
  9517.  ───────────────────────────────────────────────────────────────────────────
  9518.  
  9519.  This chapter discusses commands that control the operation of the CodeView
  9520.  debugger. The commands in this category are listed below:
  9521.  
  9522.  Command                     Action
  9523.  
  9524.  Help (H)                    Displays help
  9525.  
  9526.  Quit (Q)                    Returns to DOS
  9527.  
  9528.  Radix (N)                   Changes radix
  9529.  
  9530.  Redraw (@)                  Redraws screen
  9531.  
  9532.  Screen Exchange (\)         Switches to output screen
  9533.  
  9534.  Search (/)                  Searches for regular expression
  9535.  
  9536.  Shell Escape (!)            Starts new DOS shell
  9537.  
  9538.  Tab Set (#)                 Sets tab size
  9539.  
  9540.  Option (O)                  Views or sets CodeView options
  9541.  
  9542.  Redirection and related     Control redirection of CodeView output or input
  9543.  commands
  9544.  
  9545.  
  9546.  11.1  Help Command
  9547.  
  9548.  CodeView has two help systems: a complete on-line Help system available only
  9549.  in window mode and a syntax summary available with sequential mode.
  9550.  
  9551.  Mouse
  9552.  
  9553.  To enter the complete on-line Help system with the mouse, point to View on
  9554.  the menu bar, press a mouse button and drag the highlight down to a Help
  9555.  selection, then release the button. The appropriate help screen will appear.
  9556.  
  9557.  Keyboard
  9558.  
  9559.  If you are in window mode, press F1 to enter the complete on-line Help
  9560.  system. If you are in sequential mode, a syntax-summary screen appears when
  9561.  you press F1.
  9562.  
  9563.  Dialog
  9564.  
  9565.  If you are in window mode, you can view the complete on-line Help system
  9566.  with the following command:
  9567.  
  9568.       H
  9569.  
  9570.  If you are in sequential mode, this command displays a screen containing all
  9571.  CodeView dialog commands with the syntax for each. This screen is the only
  9572.  help available in sequential mode.
  9573.  
  9574.  
  9575.  11.2  Quit Command
  9576.  
  9577.  The Quit command terminates CodeView and returns control to DOS.
  9578.  
  9579.  Mouse
  9580.  
  9581.  To quit the CodeView debugger with the mouse, point to File on the menu,
  9582.  press a mouse button and drag the highlight down to the Exit selection, then
  9583.  release the button. The CodeView screen is replaced by the DOS screen with
  9584.  the cursor at the DOS prompt.
  9585.  
  9586.  Keyboard
  9587.  
  9588.  To quit the CodeView debugger with a keyboard command, press ALT+F to open
  9589.  the File menu, then press X to select Exit. The CodeView screen is replaced
  9590.  by the DOS screen with the cursor at the DOS prompt.
  9591.  
  9592.  Dialog
  9593.  
  9594.  To quit the CodeView debugger with a dialog command, enter a command line
  9595.  with the following syntax:
  9596.  
  9597.       Q
  9598.  
  9599.  When the command is entered, the CodeView screen is replaced by the DOS
  9600.  screen with the cursor at the DOS prompt.
  9601.  
  9602.  
  9603.  11.3  Radix Command
  9604.  
  9605.  The Radix command changes the current radix for entering arguments and
  9606.  displaying the value of expressions. The default radix when you start the
  9607.  CodeView debugger is 10 (decimal). Radixes 8 (octal) and 16 (hexadecimal)
  9608.  can also be set. Binary and other radixes are not allowed.
  9609.  
  9610.  The following seven conditions are exceptions; they are not affected by the
  9611.  Radix command:
  9612.  
  9613.    1. The radix for entering a new radix is always decimal.
  9614.  
  9615.    2. Format specifiers given with the Display Expression command or any of
  9616.       the Watch Statement commands override the current radix.
  9617.  
  9618.    3. Addresses output by the Assemble, Dump, Enter, Examine Symbol, and
  9619.       Unassemble commands are always shown in hexadecimal.
  9620.  
  9621.    4. In assembly mode, all values are shown in hexadecimal.
  9622.  
  9623.    5. The display radix for Dump, Watch Memory, and Tracepoint Memory
  9624.       commands is always hexadecimal if the size is bytes, words, or double
  9625.       words and always decimal if the size is integers, unsigned integers,
  9626.       short reals, long reals, or 10-byte reals.
  9627.  
  9628.    6. The input radix for the Enter commands with the prompting method is
  9629.       always hexadecimal if the size is bytes, words, or double words and
  9630.       always decimal if the size is integers, unsigned integers, short reals,
  9631.       long reals, or 10-byte reals. The current radix is used for all values
  9632.       given as part of a list, except real numbers, which must be entered in
  9633.       decimal.
  9634.  
  9635.    7. The register display is always in hexadecimal.
  9636.  
  9637.  Mouse
  9638.  
  9639.  You cannot change the input radix with the mouse.
  9640.  
  9641.  Keyboard
  9642.  
  9643.  You cannot change the input radix with a keyboard command.
  9644.  
  9645.  Dialog
  9646.  
  9647.  To change the input radix with a dialog command, enter a command line with
  9648.  the following syntax:
  9649.  
  9650.       N«radixnumber»
  9651.  
  9652.  The radixnumber can be 8 (octal), 10 (decimal), or 16 (hexadecimal). The
  9653.  default radix when you start the CodeView debugger is 10 (decimal), unless
  9654.  your
  9655.  
  9656.  main program is written with the Microsoft Macro Assembler, in which case
  9657.  the default radix is 16 (hexadecimal). If you give the Radix command with no
  9658.  argument, the debugger displays the current radix.
  9659.  
  9660.  Examples
  9661.  
  9662.       >N10
  9663.       >N
  9664.       10
  9665.       >? prime
  9666.       107
  9667.       >
  9668.  
  9669.       >N8  ;* C example
  9670.       >? prime
  9671.       0153
  9672.       >
  9673.  
  9674.       >N16 ;* FORTRAN example
  9675.       >? prime
  9676.       #006b
  9677.       >
  9678.  
  9679.       >N8  ;* BASIC example
  9680.       >? prime
  9681.       &O153
  9682.       >
  9683.  
  9684.  The example above shows how 107 decimal, stored in the variable prime, would
  9685.  be displayed with different radixes. Examples are taken from different
  9686.  languages; there is no logical connection between the radix and the language
  9687.  used in each example.
  9688.  
  9689.       >N8
  9690.       >? 34,i
  9691.       28
  9692.       >N10
  9693.       >? 28,i
  9694.       28
  9695.       >N16
  9696.       >? 1C,i
  9697.       28
  9698.       >
  9699.  
  9700.  In the example above, the same number is entered in different radixes, but
  9701.  the i format specifier is used to display the result as a decimal integer in
  9702.  all three cases. See Chapter 6, "Examining Data and Expressions," for more
  9703.  information on format specifiers.
  9704.  
  9705.  
  9706.  11.4  Redraw Comm and
  9707.  
  9708.  The Redraw command can be used only in window mode; it redraws the CodeView
  9709.  screen. This command is seldom necessary, but you might need it if the
  9710.  output of the program being debugged disturbs the CodeView display
  9711.  temporarily.
  9712.  
  9713.  Mouse
  9714.  
  9715.  You cannot redraw the screen using the mouse.
  9716.  
  9717.  Keyboard
  9718.  
  9719.  You cannot redraw the screen using a keyboard command.
  9720.  
  9721.  Dialog
  9722.  
  9723.  To redraw the screen with a dialog command, enter a command line with the
  9724.  following syntax:
  9725.  
  9726.       @
  9727.  
  9728.  
  9729.  11.5  Screen Exchange Command
  9730.  
  9731.  The Screen Exchange command allows you to switch temporarily from the
  9732.  debugging screen to the output screen.
  9733.  
  9734.  The CodeView debugger will use either screen flipping or screen swapping to
  9735.  store the output and debugging screens. See Chapter 1, "Getting Started,"
  9736.  for an explanation of flipping and swapping.
  9737.  
  9738.  Mouse
  9739.  
  9740.  To execute the Screen Exchange command with the mouse, open the View menu,
  9741.  then select Output. Press any key when you are ready to return to the
  9742.  debugging screen.
  9743.  
  9744.  Keyboard
  9745.  
  9746.  To execute the Screen Exchange command with a keyboard command, press F4.
  9747.  Press any key when you are ready to return to the debugging screen.
  9748.  
  9749.  Dialog
  9750.  
  9751.  To execute the Screen Exchange command from the dialog window, enter a
  9752.  command line with the following syntax:
  9753.  
  9754.       \
  9755.  
  9756.  The output screen will then appear. Press any key when you are ready to
  9757.  return to the CodeView debugging screen.
  9758.  
  9759.  
  9760.  11.6  Search Command
  9761.  
  9762.  The Search command allows you to search for a regular expression in a source
  9763.  file. The expression being sought is specified either in a dialog box or as
  9764.  an argument to a dialog command. Once you have found an expression, you can
  9765.  search for the next or previous occurrence of the expression.
  9766.  
  9767.  Regular expressions are patterns of characters that may match one or many
  9768.  different strings. The use of patterns to match more than one string is
  9769.  similar to the DOS method of using wild-card characters in file names.
  9770.  Regular expressions are explained in detail in Appendix A.
  9771.  
  9772.  You can use the Search command without understanding regular expressions.
  9773.  Since text strings are the simplest form of regular expressions, you can
  9774.  enter a string of characters as the expression you want to find. For
  9775.  example, you could enter COUNT if you wanted to search for the word "COUNT"
  9776.  in the source file.
  9777.  
  9778.  The following characters have special meanings in regular expressions:
  9779.  backslash (\), asterisk (*), left bracket ([), period (.), dollar sign ($),
  9780.  and caret (^). To find strings containing these characters, you must precede
  9781.  the characters with a backslash; this cancels their special meanings.
  9782.  
  9783.  For example, you would use \* to find x*y. The periods in the relational
  9784.  operators must also be preceded by a backslash.
  9785.  
  9786.  The Case Sense selection from the Options menu has no effect on searches for
  9787.  regular expressions.
  9788.  
  9789.  ───────────────────────────────────────────────────────────────────────────
  9790.  NOTE
  9791.     When you search for the next occurrence of a regular expression, the
  9792.     CodeView debugger searches to the end of the file, then wraps around and
  9793.     begins again at the start of the file. This can have unexpected results
  9794.     if the expression occurs only once. When you give the command repeatedly,
  9795.     nothing seems to happen. Actually, the debugger is repeatedly wrapping
  9796.     around and finding the same expression each time.
  9797.  ───────────────────────────────────────────────────────────────────────────
  9798.  
  9799.  Mouse
  9800.  
  9801.  To find a regular expr with the mouse, point to Search on the menu bar,
  9802.  press a mouse button and drag the highlight down to the Find selection, then
  9803.  release the button. A dialog box appears, asking for the regular expression
  9804.  to be found. Type the expression and press either the ENTER key or a mouse
  9805.  button. The CodeView debugger starts searching at the current cursor
  9806.  position and puts the cursor at the next line containing the regular
  9807.  expression. An error message appears if the expression is not found. If you
  9808.  are in assembly mode, the debugger automatically switches to source mode
  9809.  when the expression is found.
  9810.  
  9811.  After you have found a regular expression, you can search for the next or
  9812.  previous occurrence of the expression. Point to Search on the menu bar,
  9813.  press a mouse button and drag the highlight down to the Next or Previous
  9814.  selection, then release the button. The cursor moves to the next or previous
  9815.  match of the expression.
  9816.  
  9817.  You can also search the executable code for a label (such as a routine name
  9818.  or an assembly-language label). Point to Search on the menu bar, press a
  9819.  mouse button and drag the highlight down to the Label selection, then
  9820.  release the button. A dialog box appears, asking for the label to be found.
  9821.  Type the label name, and press either ENTER or a mouse button. The cursor
  9822.  will move to the line containing the label. This selection differs from
  9823.  other search selections because it searches executable code rather than
  9824.  source code. The CodeView debugger switches to assembly mode, if necessary,
  9825.  to display a label in a library routine or assembly-language module.
  9826.  
  9827.  Keyboard
  9828.  
  9829.  To find a regular expression with a keyboard command, press ALT+S to open
  9830.  the Search menu, and then press F to select Find. A dialog box appears,
  9831.  asking for the regular expression to be found. Type the expression and press
  9832.  ENTER. The CodeView debugger starts searching at the current cursor position
  9833.  and puts the cursor at the next line containing the regular expression. An
  9834.  error message appears if the expression is not found. If you are in assembly
  9835.  mode, the debugger automatically switches to source mode when the expression
  9836.  is found.
  9837.  
  9838.  After you have found a regular expression, you can search for the next or
  9839.  previous occurrence of the expression. Press ALT+S to open the Search menu
  9840.  and then press N to select Next or P to select Previous. The cursor will
  9841.  move to the next or previous match of the expression.
  9842.  
  9843.  You can also search the executable code for a label (such as a routine name
  9844.  or an assembly-language label). Press ALT+S to open the Search menu and then
  9845.  press L to select Label. A dialog box appears, asking for the label to be
  9846.  found. Type the label name and press ENTER. The cursor moves to the line
  9847.  containing the label. This selection differs from other search selections
  9848.  because it searches executable code rather than source code. The CodeView
  9849.  debugger switches to assembly mode, if necessary, to display a label in a
  9850.  library routine or assembly-language module.
  9851.  
  9852.  Dialog
  9853.  
  9854.  To find a regular expression using a dialog command, enter a command line
  9855.  with the following syntax:
  9856.  
  9857.       /«regularexpression»
  9858.  
  9859.  If regularexpression is given, the CodeView debugger searches the source
  9860.  file for the first line containing the expression. If no argument is given,
  9861.  the debugger searches for the next occurrence of the last regular expression
  9862.  specified.
  9863.  
  9864.  In window mode, the CodeView debugger starts searching at the current cursor
  9865.  position and puts the cursor at the next line containing the regular
  9866.  expression. In sequential mode, the debugger starts searching at the last
  9867.  source line displayed. It displays the source line in which the expression
  9868.  is found. An error message appears if the expression is not found. If you
  9869.  are in assembly mode, the CodeView debugger automatically switches to source
  9870.  mode when the expression is found.
  9871.  
  9872.  You cannot search for a label with the dialog version of the Search command,
  9873.  but you can use the View command with the label as an argument for the same
  9874.  effect.
  9875.  
  9876.  
  9877.  11.7  Shell Escape Command
  9878.  
  9879.  The Shell Escape command allows you to exit from the CodeView debugger to a
  9880.  DOS shell. You can execute DOS commands or programs from within the
  9881.  debugger, or you can exit from the debugger to DOS while retaining your
  9882.  current debugging context.
  9883.  
  9884.  The Shell Escape command works by saving the current processes in memory and
  9885.  then executing a second copy of COMMAND.COM. The COMSPEC environment
  9886.  variable is used to locate a copy of COMMAND.COM.
  9887.  
  9888.  Opening a shell requires a significant amount of free memory (usually more
  9889.  than 200K) because the CodeView debugger, the symbol table, COMMAND.COM, and
  9890.  the program being debugged must all be saved in memory. If you do not have
  9891.  enough memory, an error message appears. Even if you have enough memory to
  9892.  start a new shell, you may not have enough memory left to execute large
  9893.  programs from the shell.
  9894.  
  9895.  If you change directories while working in the shell, make sure you return
  9896.  to the original directory before returning to the CodeView debugger. If you
  9897.  don't, the debugger may not be able to find and load source files when it
  9898.  needs them.
  9899.  
  9900.  ───────────────────────────────────────────────────────────────────────────
  9901.  NOTE
  9902.     In order to use the Shell Escape command, the executable file being
  9903.     debugged must release unneeded memory. Programs created with Microsoft
  9904.     compilers release memory during start-up.
  9905.  
  9906.     You cannot use the Shell Escape command with assembler programs unless
  9907.     the program specifically releases memory by using the DOS function call
  9908.     4A hexadecimal (Set Block) or is linked with the /CPARMAXALLOC link
  9909.     option.
  9910.  ───────────────────────────────────────────────────────────────────────────
  9911.  
  9912.  Mouse
  9913.  
  9914.  To open a DOS shell with the mouse, point to File on the menu bar, press a
  9915.  mouse button and drag the highlight down to the DOS Shell selection, then
  9916.  release the button. If there is enough memory to open the shell, the DOS
  9917.  screen appears. You can execute any DOS command or any program. When you are
  9918.  ready to return to the debugging session, type the command exit (in any
  9919.  combination of uppercase and lowercase letters). The debugging screen will
  9920.  appear with the same status it had when you left it.
  9921.  
  9922.  Keyboard
  9923.  
  9924.  To open a DOS shell with a keyboard command, press ALT+F to open the File
  9925.  menu, then press D to select DOS Shell. If there is enough memory to open
  9926.  the shell, the DOS screen appears. You can execute any DOS internal command
  9927.  or any program. When you are ready to return to the debugging session, type
  9928.  the command exit (in any combination of uppercase and lowercase letters).
  9929.  The debugging screen will appear with the same status it had when you left
  9930.  it.
  9931.  
  9932.  Dialog
  9933.  
  9934.  To open a DOS shell using a dialog command, enter a command line with the
  9935.  following syntax:
  9936.  
  9937.       !«command»
  9938.  
  9939.  If you want to exit to DOS and execute several programs or commands, enter
  9940.  the command with no arguments. The CodeView debugger executes a new copy of
  9941.  COMMAND.COM, and the DOS screen appears. You can run programs or DOS
  9942.  internal commands. When you are ready to return to the debugger, type the
  9943.  command exit (in any combination of uppercase and lowercase letters). The
  9944.  debugging screen appears with the same status it had when you left it.
  9945.  
  9946.  If you want to execute a program or DOS internal command from within
  9947.  CodeView, enter the Shell Escape command (!) followed by the name of the
  9948.  command or the program you want to execute. The output screen appears, and
  9949.  the debugger executes the command or program. When the output from the
  9950.  command or program is completed, the message Press any key to continue...
  9951.  appears at the bottom of the screen. Press a key to make the debugging
  9952.  screen reappear with the same status it had when you left it.
  9953.  
  9954.  Examples
  9955.  
  9956.       >!
  9957.  
  9958.  In the above example, the CodeView debugger saves the current debugging
  9959.  context and executes a copy of COMMAND.COM. The DOS screen appears, and you
  9960.  can enter any number of commands. To return to the debugger, enter exit.
  9961.  
  9962.       >!DIR a:*.for
  9963.  
  9964.  In the example above, the DOS command DIR is executed with the argument
  9965.  a:*.for. The directory listing will be followed by a prompt telling you to
  9966.  press any key to return to the CodeView debugging screen.
  9967.  
  9968.       >!CHKDSK a:
  9969.  
  9970.  In the example above, the DOS command CHKDSK is executed, and the status of
  9971.  the disk in Drive A is displayed in the dialog window. The program name
  9972.  specified could be for any executable file, not just that for a DOS program.
  9973.  
  9974.  
  9975.  11.8  Tab Set Command
  9976.  
  9977.  The Tab Set command sets the width in spaces that the CodeView debugger
  9978.  fills for each tab character. The default tab is eight spaces. You might
  9979.  want to set a smaller tab size if your source code has so many levels of
  9980.  indentation that source lines extend beyond the edge of the screen. This
  9981.  command has no effect if your source code was written with an editor that
  9982.  indents with spaces rather than tab characters.
  9983.  
  9984.  Mouse
  9985.  
  9986.  You cannot set the tab size by using the mouse.
  9987.  
  9988.  Keyboard
  9989.  
  9990.  You cannot set the tab size by using a keyboard command.
  9991.  
  9992.  Dialog
  9993.  
  9994.  To set the tab size with a dialog command, enter a command line with the
  9995.  following syntax:
  9996.  
  9997.       #number
  9998.  
  9999.  The number is the new number of characters for each tab character. In window
  10000.  mode, the screen is redrawn with the new tab width when you enter the
  10001.  command. In sequential mode, any output of source lines reflects the new tab
  10002.  size.
  10003.  
  10004.  Example
  10005.  
  10006.       >.
  10007.       32:                IF (X(I)) .LE. X(J)) GOTO 301
  10008.       >#4
  10009.       >.
  10010.       32:        IF (X(I)) .LE. X(J)) GOTO 301
  10011.       >
  10012.  
  10013.  In the example above, the Source Line command (.) is used to show the source
  10014.  line with the default tab width of eight spaces. Next, the Tab Set command
  10015.  is used to set the tab width to four spaces. The Source Line command then
  10016.  shows the same line.
  10017.  
  10018.  
  10019.  11.9  Option Command
  10020.  
  10021.  The Option command allows you to view the state of options in the Option
  10022.  menu (Flip/Swap, Bytes Coded, Case Sense, and 386) and to turn any of the
  10023.  these options on or off.
  10024.  
  10025.  For each different kind of source module that you debug, there is a
  10026.  different set of default settings. However, the use of the Option command
  10027.  overrides any of these settings.
  10028.  
  10029.  Mouse
  10030.  
  10031.  To view the state of the options with a mouse, simply point to Options on
  10032.  the menu bar and click either button. Each option is displayed. Those
  10033.  options that are turned on have a double arrow immediately to the left.
  10034.  Options that are turned off have no double arrow.
  10035.  
  10036.  To change one of the Option settings, drag the highlight down to the option
  10037.  you wish to change and release the button. This reverses the state of the
  10038.  option. (An option that was on will be turned off and vice versa.)
  10039.  
  10040.  Keyboard
  10041.  
  10042.  To view the state of the Options menu with a keyboard command, press ALT+O
  10043.  to open the Options menu. Each option is displayed. Those options that are
  10044.  turned on have a double arrow immediately to the left. Options that are
  10045.  turned off have no double arrow.
  10046.  
  10047.  To change one of the Option settings, press the letter key corresponding to
  10048.  the option's mnemonic. This reverses the state of the option. (An option
  10049.  that was on will be turned off and vice versa.) You can also reverse an
  10050.  option by moving the highlight down with the arrow key and pressing ENTER.
  10051.  
  10052.  Dialog
  10053.  
  10054.  To view or change options with a dialog command, enter a command line with
  10055.  the following syntax:
  10056.  
  10057.       O«option «+ | -»»
  10058.  
  10059.  In the above display, option is one of the following characters: F, B, C,
  10060.  or 3. If used, there must be no spaces between the character and the O.
  10061.  These characters correspond to the options as shown below:
  10062.  
  10063.  Command                     Correspondence
  10064.  
  10065.  OF                          Flip/Swap option
  10066.  
  10067.  OB                          Bytes-Coded option
  10068.  
  10069.  OC                          Case-Sense option
  10070.  
  10071.  O3                          386 option
  10072.  
  10073.  O                           All options
  10074.  
  10075.  The O form of the command (all options) takes no arguments; it displays the
  10076.  state of all four options. The other forms of the command (OF, OB, OC, and
  10077.  O3) can be used either with no arguments (in which case they display the
  10078.  state of the option) or they can take the argument + or -.
  10079.  
  10080.  The + argument turns the option on. The - argument turns the option off.
  10081.  
  10082.  Examples
  10083.  
  10084.       >O
  10085.       Flip/Swap on
  10086.       Bytes Coded on
  10087.       Case Sense off
  10088.       386 off
  10089.       >O3
  10090.       386 off
  10091.       >O3+
  10092.       386 on
  10093.       >OF
  10094.       Flip/Swap on
  10095.       >OF-
  10096.       Flip/Swap off
  10097.  
  10098.  In the example above, the O, O3, and OF commands are used to view the
  10099.  current state of an option. Each of the O3+ and OF- commands modifies an
  10100.  option and then reports the results of the modification.
  10101.  
  10102.  The dialog version of the Option command is particularly useful for
  10103.  redirected CodeView commands (which cannot access menus) and for making the
  10104.  debugger start up with certain options. For example, the following DOS-level
  10105.  command line brings up CodeView with the 386 option on and Bytes Coded off:
  10106.  
  10107.       CV /c"O3+;OB-" test
  10108.  
  10109.  This command line could then be placed into a batch file for convenient
  10110.  execution.
  10111.  
  10112.  
  10113.  11.10  Redirection Commands
  10114.  
  10115.  The CodeView debugger provides several options for redirecting commands from
  10116.  or to devices or files. Furthermore, the debugger provides several other
  10117.  commands, which are relevant only when used with redirected files.
  10118.  
  10119.  Mouse
  10120.  
  10121.  None of the redirection or related commands can be executed with the mouse.
  10122.  
  10123.  Keyboard
  10124.  
  10125.  None of the redirection or related commands can be executed with keyboard
  10126.  commands.
  10127.  
  10128.  Dialog
  10129.  
  10130.  The redirection commands are entered with dialog commands, as shown in
  10131.  Sections 11.10.1-11.10.4.3 below.
  10132.  
  10133.  
  10134.  11.10.1  Redirecting CodeView Input
  10135.  
  10136.  Syntax
  10137.  
  10138.       < devicename
  10139.  
  10140.  The Redirected Input command causes the CodeView debugger to read all
  10141.  subsequent command input from a device, such as another terminal or a file.
  10142.  The sample session supplied with most versions of the debugger is an example
  10143.  of commands being redirected from a file.
  10144.  
  10145.  Examples
  10146.  
  10147.       ><COM1
  10148.  
  10149.  The example above redirects commands from the device (probably a remote
  10150.  terminal) designated as COM1 to the CodeView terminal.
  10151.  
  10152.       ><INFILE.TXT
  10153.  
  10154.  The example above redirects command input from file INFILE.TXT to the
  10155.  CodeView debugger. You might use this command to prepare a CodeView session
  10156.  for someone else to run. You create a text file containing a series of
  10157.  commands separated by carriage-return and line-feed combinations or
  10158.  semicolons. When you redirect the file, the debugger executes the commands
  10159.  to the end of the file. One way to create such a file is to redirect
  10160.  commands from the CodeView debugger to a file (see Section 11.10.3 below)
  10161.  and then edit the file to eliminate the output and add comments.
  10162.  
  10163.  
  10164.  11.10.2  Redirecting CodeView Output
  10165.  
  10166.  Syntax
  10167.  
  10168.       «T»>«>»devicename
  10169.  
  10170.  The Redirected Output command causes the CodeView debugger to write all
  10171.  subsequent command output to a device, such as another terminal, a printer,
  10172.  or a file. The term "output" includes not only the output from commands but
  10173.  also the command characters that are echoed as you type them.
  10174.  
  10175.  The optional T indicates that the output should be echoed to the CodeView
  10176.  screen. Normally, you will want to use the T if you are redirecting output
  10177.  to a file so you can see what you are typing. However, if you are
  10178.  redirecting output to another terminal, you may not want to see the output
  10179.  on the CodeView terminal.
  10180.  
  10181.  The second greater-than symbol (optional) appends the output to an existing
  10182.  file. If you redirect output to an existing file without this symbol, the
  10183.  existing file is replaced.
  10184.  
  10185.  Examples
  10186.  
  10187.       >>COM1
  10188.  
  10189.  In the example above, output is redirected to the device designated as COM1
  10190.  (probably a remote terminal). You might want to enter this command, for
  10191.  example, when you are debugging a graphics program and want CodeView
  10192.  commands to be displayed on a remote terminal while the program display
  10193.  appears on the originating terminal.
  10194.  
  10195.       >T>OUTFILE.TXT
  10196.       .
  10197.       .
  10198.       .
  10199.       >>CON
  10200.       .
  10201.       .
  10202.       .
  10203.  
  10204.  In the example above, output is redirected to the file OUTFILE.TXT. This
  10205.  command is helpful in keeping a permanent record of a CodeView session. Note
  10206.  that the optional T is used so that the session is echoed to the CodeView
  10207.  screen as well as to the file. After redirecting some commands to a file,
  10208.  output is returned to the console (terminal) with the command >CON.
  10209.  
  10210.       >T>>OUTFILE.TXT
  10211.  
  10212.  If, later in the session, you want to redirect more commands to the same
  10213.  file, use the double greater-than symbol, as in the example above, to append
  10214.  the output to the existing file.
  10215.  
  10216.  
  10217.  11.10.3  Redirecting CodeView Input and Output
  10218.  
  10219.  Syntax
  10220.  
  10221.       = devicename
  10222.  
  10223.  The Redirected Input and Output command causes the CodeView debugger to
  10224.  write all subsequent command output to a device and simultaneously to
  10225.  receive input from the same device. This command is practical only if the
  10226.  device is a remote terminal.
  10227.  
  10228.  Redirecting input and output works best if you start in sequential mode
  10229.  (using the /T option). The CodeView debugger's window interface has little
  10230.  purpose in this situation since the remote terminal can act only as a
  10231.  sequential (nonwindow) device.
  10232.  
  10233.  Example
  10234.  
  10235.       >=COM1
  10236.  
  10237.  In the example above, output and input are redirected to the device
  10238.  designated as COM1. This command would be useful if you wanted to enter
  10239.  debugging commands and see the debugger output on a remote terminal while
  10240.  entering program commands and viewing program output on the terminal where
  10241.  the debugger is running.
  10242.  
  10243.  
  10244.  11.10.4  Commands Used with Redirection
  10245.  
  10246.  The following commands are intended for use when redirecting commands to or
  10247.  from a file. Although they are always available, these commands have little
  10248.  practical use during a normal debugging session.
  10249.  
  10250.  Command                     Action
  10251.  
  10252.  Comment (*)                 Displays comment
  10253.  
  10254.  Delay (:)                   Delays execution of commands from a redirected
  10255.                              file
  10256.  
  10257.  Pause (")                   Interrupts execution of commands from a
  10258.                              redirected file until a key is pressed
  10259.  
  10260.  
  10261.  11.10.4.1  Comment Command
  10262.  
  10263.  Syntax
  10264.  
  10265.       *comment
  10266.  
  10267.  The Comment command is an asterisk (*) followed by text. The CodeView
  10268.  debugger echoes the text of the comment to the screen (or other output
  10269.  device). This command is useful in combination with the redirection commands
  10270.  when you are saving a commented session or when writing a commented session
  10271.  that will be redirected to the debugger.
  10272.  
  10273.  Examples
  10274.  
  10275.       >T>OUTPUT.TXT
  10276.       >* Dump first 20 bytes of screen buffer
  10277.       >D #B800:0 L 20
  10278.       B800:0000 54 17 6F 17 20 17 72 17 65 17 74 17 75 17 72 17 T.o. .r.e.t.u.
  10279.       B800:0010 6E 17 20 17                                     n. .
  10280.       >
  10281.  
  10282.  In the example above, the user is sending a copy of a CodeView session to
  10283.  file OUTPUT.TXT. Comments are added to explain the purpose of the command.
  10284.  The text file will contain commands, comments, and command output.
  10285.  
  10286.       * Dump first 20 bytes of screen buffer
  10287.       D #B800:0 L 20
  10288.       .
  10289.       .
  10290.       .
  10291.       < CON
  10292.  
  10293.  The example above illustrates another way to use the Comment command. You
  10294.  can put comments into a text file of commands that are executed
  10295.  automatically when you redirect the file into the CodeView debugger. In this
  10296.  example, an editing program was used to create the text file called
  10297.  INPUT.TXT.
  10298.  
  10299.       ><INPUT.TXT
  10300.       >* Dump first 20 bytes of screen buffer
  10301.       >D #B800:0 L 20
  10302.       B800:0000 54 17 6F 17 20 17 72 17 65 17 74 17 75 17 72 17 T.o. .r.e.t.u.
  10303.       B800:0010 6E 17 20 17n. .
  10304.       .
  10305.       .
  10306.       .
  10307.       >< CON
  10308.       >
  10309.  
  10310.  When you read the file into the debugger by using the Redirected Input
  10311.  command, you see the comment, the command, and the output from the command,
  10312.  as in the example above.
  10313.  
  10314.  11.10.4.2  Delay Command
  10315.  
  10316.  Syntax
  10317.  
  10318.       :
  10319.  
  10320.  The Delay command interrupts execution of commands from a redirected file
  10321.  and waits about half a second before continuing. You can put multiple Delay
  10322.  commands on a single line to increase the length of delay. The delay is the
  10323.  same length regardless of the processing speed of the computer.
  10324.  
  10325.  Example
  10326.  
  10327.       : ;* That was a short delay...
  10328.       ::::: ;* That was a longer delay...
  10329.  
  10330.  In the example above, the Delay command is used to slow execution of the
  10331.  redirected file into the CodeView debugger.
  10332.  
  10333.  11.10.4.3  Pause Command
  10334.  
  10335.  Syntax
  10336.  
  10337.       "
  10338.  
  10339.  The Pause command interrupts execution of commands from a redirected file
  10340.  and waits for the user to press a key. Execution of the redirected commands
  10341.  begins as soon as a key is pressed.
  10342.  
  10343.  Example
  10344.  
  10345.       * Press any key to continue
  10346.       "
  10347.  
  10348.  In the example above from a text file that might be redirected into the
  10349.  CodeView debugger, a Comment command is used to prompt the user to press a
  10350.  key. The Pause command is then used to halt execution until the user
  10351.  responds.
  10352.  
  10353.       >* Press any key to continue
  10354.       >"
  10355.  
  10356.  The example above shows the output when the text is redirected into the
  10357.  debugger. The next CodeView prompt does not appear until the user presses a
  10358.  key.
  10359.  
  10360.  
  10361.  Chapter 12  Debugging in Protected Mode
  10362.  ───────────────────────────────────────────────────────────────────────────
  10363.  
  10364.  The protected-mode CodeView debugger (CVP.EXE) supports all the special
  10365.  programming features of OS/2 protected mode: dynamic-link libraries,
  10366.  multiple processes, and multiple threads within a process. CodeView lets you
  10367.  stop execution, then switch between individual processes and threads.
  10368.  
  10369.  The support for thread debugging is especially powerful because it lets you
  10370.  block (or "freeze") selected threads while letting others run. You can set
  10371.  breakpoints applicable to all threads or only to a specific thread.
  10372.  
  10373.  Note that you must use the protected-mode CodeView debugger (CVP.EXE) in
  10374.  order to run CodeView in protected mode or debug protected-mode programs.
  10375.  Furthermore, before you run CVP you must set IOPL=YES in your CONFIG.SYS
  10376.  file.
  10377.  
  10378.  This chapter deals with the following topics:
  10379.  
  10380.    ■  Using CodeView in real and protected mode
  10381.  
  10382.    ■  Debugging dynamic-link libraries
  10383.  
  10384.    ■  Debugging multiple processes
  10385.  
  10386.    ■  Debugging multiple threads
  10387.  
  10388.  All the techniques presented in this chapter can be used together. You can
  10389.  debug multiple processes, and within each process debug multiple threads.
  10390.  
  10391.  
  10392.  12.1  Using CodeView in Different Modes
  10393.  
  10394.  Chapters 1-11 assume that the real-mode CodeView debugger (CV.EXE) is
  10395.  running in real mode, debugging a real-mode program. This section summarizes
  10396.  the major considerations and limitations of other situations.
  10397.  
  10398.  As noted above, to debug a protected-mode program, you must run CVP.EXE in
  10399.  protected mode. You must first set IOPL=YES. This setting enables
  10400.  applications to run at Ring 3, giving programs low-level access. CodeView
  10401.  needs to run at this level because it does direct-hardware access.
  10402.  
  10403.  ───────────────────────────────────────────────────────────────────────────
  10404.  WARNING
  10405.     If you do not set IOPL=YES before running CVP, CVP fails to run and the
  10406.     system does not give you a clear message explaining why CodeView failed.
  10407.     The system may  become unstable and fail at any time.
  10408.  ───────────────────────────────────────────────────────────────────────────
  10409.  
  10410.  You must also use CVP in order to debug a bound program. The restrictions
  10411.  mentioned above apply. Real-mode CodeView cannot debug a bound program.
  10412.  
  10413.  The real-mode debugger can run in the 3.x compatibility box. However, when
  10414.  you run CodeView in the compatibility box, include /S on the command line.
  10415.  Otherwise, the mouse pointer does not appear.
  10416.  
  10417.  
  10418.  12.2  Debugging Dynamic-Link Libraries
  10419.  
  10420.  The protected-mode CodeView debugger (CVP) can debug dynamic-link modules
  10421.  but only if it is told what libraries to search at run time. For more
  10422.  information on dynamic-link libraries, refer to the Microsoft Operating
  10423.  System/2 Programmer's Guide.
  10424.  
  10425.  When you place a module in a dynamic-link library, neither code nor symbolic
  10426.  information for that module is stored in the executable (.EXE) file;
  10427.  instead, the code and symbols are stored in the library and are not brought
  10428.  together with the main program until run time.
  10429.  
  10430.  Thus, the protected-mode debugger needs to search the dynamic-link library
  10431.  for symbolic information. Because the debugger does not automatically know
  10432.  what libraries to look for, CVP has an additional command-line option that
  10433.  enables you to specify dynamic-link libraries:
  10434.  
  10435.  Syntax
  10436.  
  10437.       /L file
  10438.  
  10439.  The /L option directs the CodeView debugger to search file for symbolic
  10440.  information. When you use this option, at least one space must separate /L
  10441.  from file.
  10442.  
  10443.  Example
  10444.  
  10445.       CVP /L DLIB1.DLL /L GRAFLIB.DLL PROG
  10446.  
  10447.  In the example above, CVP is invoked to debug the program PROG.EXE. To find
  10448.  symbolic information needed for debugging each module, CVP searches the
  10449.  libraries DLIB1.DLL and GRAFLIB.DLL, as well as the executable file
  10450.  PROG.EXE.
  10451.  
  10452.  
  10453.  12.3  Debugging Multiple Processes
  10454.  
  10455.  To enable debugging of multiple processes, you must first start up CodeView
  10456.  with the /O (offspring) option. The syntax of this option is simple, as it
  10457.  takes no arguments.
  10458.  
  10459.  Syntax
  10460.  
  10461.       /O
  10462.  
  10463.  If you do not use the /O option (or the option cannot be used), CodeView
  10464.  lets your program spawn new processes, but you will not be able to view or
  10465.  trace through these processes. They run in the background as far as CodeView
  10466.  is concerned.
  10467.  
  10468.  For example, to debug multiple processes of the program SPACEMAN.EXE you
  10469.  would use the following command:
  10470.  
  10471.       CVP /O SPACEMAN
  10472.  
  10473.  The /O option has two limitations:
  10474.  
  10475.    1. You must have OS/2 Version 1.1 or later to use it.
  10476.  
  10477.    2. This option is incompatible with the /2 option.
  10478.  
  10479.  The rest of this section assumes that you have successfully started CodeView
  10480.  with the /O option.
  10481.  
  10482.  Every time your program executes a line of code that spawns a child process,
  10483.  CodeView responds by displaying the process ID number (Pid) and asking if
  10484.  you wish to debug the child process. The message displayed is similar to the
  10485.  following:
  10486.  
  10487.       Pid 24 started. Do you wish to debug (y/n)?
  10488.  
  10489.  To debug the child process, type Y and then press ENTER. Type any other
  10490.  letter for no. CodeView takes a different course of action depending on your
  10491.  response.
  10492.  
  10493.    ■  If you respond yes, CodeView spawns a new CodeView process. This
  10494.       process controls execution of your program's child process. Each
  10495.       instance of CodeView spawned in this way becomes a separate debugging
  10496.       session.
  10497.  
  10498.       A new process runs in the same screen group as its parent process
  10499.       (unless you call the DosStartSession system function). Using CodeView
  10500.       does not change this. However, each new instance of CodeView always
  10501.       runs in its own screen group. Since OS/2 supports a maximum of 16
  10502.       screen groups, the number of child processes that you can debug at one
  10503.       time is limited.
  10504.  
  10505.    ■  If you respond no, CodeView lets the program spawn the child process.
  10506.       However, you will not be able to control or trace the child process
  10507.       with CodeView. The child process is active but not accessible to
  10508.       CodeView commands.
  10509.  
  10510.  You can move between different CodeView processes in the following two ways:
  10511.  by using the OS/2 Session Manager or the Process command (|). The Process
  10512.  command, in turn, has two forms. You can use this command to view status of
  10513.  child processes or to switch directly to the debugging session of the child
  10514.  process.
  10515.  
  10516.  ───────────────────────────────────────────────────────────────────────────
  10517.  NOTE
  10518.     You may need to make note of process ID numbers when CodeView spawns a
  10519.     process. CodeView identifies multiple processes only by their ID numbers.
  10520.  ───────────────────────────────────────────────────────────────────────────
  10521.  
  10522.  
  10523.  12.3.1  Viewing Status
  10524.  
  10525.  To view the status of the child processes (of the current process), enter
  10526.  the Process command followed by no arguments:
  10527.  
  10528.       |
  10529.  
  10530.  CodeView responds by displaying three fields: process ID number, session
  10531.  (screen group) ID number, and yes or no, depending on whether or not each
  10532.  process has its own instance of CodeView. The following example shows a
  10533.  sample process status for a process with three children:
  10534.  
  10535.       001|
  10536.       ProcessID   SessionID    Debugging
  10537.       00024         00006 Yes
  10538.       00026         00006 Yes
  10539.       00028         00006 No
  10540.  
  10541.  In the example above, only processes 24 and 26 can be debugged. Each of
  10542.  these processes corresponds to a different instance of CodeView, and each
  10543.  instance runs in a separate screen group. Process 28 is active but cannot be
  10544.  debugged.
  10545.  
  10546.  
  10547.  12.3.2  Switching to a Child Process
  10548.  
  10549.  If a child process can be debugged, you can switch to that process directly
  10550.  by using the Process command. Use of this command accomplishes the same end
  10551.  as using the Session Manager but is more direct.
  10552.  
  10553.  To switch to the debugging session for a child process, enter the Process
  10554.  command with the following syntax:
  10555.  
  10556.       | processID
  10557.  
  10558.  in which processID is the process ID (Pid) of the process you wish to debug.
  10559.  
  10560.  ───────────────────────────────────────────────────────────────────────────
  10561.  NOTE
  10562.     The Process command only works with direct children. In other words, you
  10563.     can spawn a child which in turns spawns another child. The Process
  10564.     command does not give you direct access to the "grandchild." Instead, you
  10565.     must switch to the intermediate parent.
  10566.  
  10567.     To return to debugging a parent or grandparent, you must use the OS/2
  10568.     Session Manager.
  10569.  ───────────────────────────────────────────────────────────────────────────
  10570.  
  10571.  
  10572.  12.4  Debugging Multiple Threads
  10573.  
  10574.  A program running in OS/2 protected mode has one or more threads. Threads
  10575.  are the fundamental units of execution; OS/2 can execute a number of
  10576.  different threads concurrently. A thread is similar to a process, yet it can
  10577.  be created or terminated much faster. Threads begin at a function-definition
  10578.  heading in the same program in which they are invoked.
  10579.  
  10580.  The existence of multiple threads within a program presents a dilemma for
  10581.  debugging. For example, thread 1 may be executing source line 23 while
  10582.  thread 2 is executing source line 78. Which line of code does the CodeView
  10583.  debugger consider to be the current line?
  10584.  
  10585.  Conversely, you cannot always tell which thread is executing even if you
  10586.  know what the current source line is. In OS/2 protected mode, you can write
  10587.  a program in which two threads enter the same function.
  10588.  
  10589.  In Figure 12.1, the function main uses the DOSCREATETHREAD system call to
  10590.  begin execution of thread 2. The function f2 is the entry point of the new
  10591.  thread. Thread 2 begins and terminates inside the function f2. Before it
  10592.  terminates, however, thread 2 can enter other functions by means of ordinary
  10593.  function calls.
  10594.  
  10595.  Thread 1 begins execution in the function main, and thread 2 begins
  10596.  execution in the function f2. Later, both thread 1 and thread 2 enter the
  10597.  function f3. (Note that each thread returns to the proper place because each
  10598.  thread has its own stack.) When you use the debugger to examine the behavior
  10599.  of code within the function f3, how can you tell which thread you are
  10600.  tracking?
  10601.  
  10602.  The protected-mode CodeView debugger solves this dilemma by using a modified
  10603.  CodeView prompt and by providing the Thread command, which is only available
  10604.  with CVP.
  10605.  
  10606.  The command prompt for the protected-mode CodeView debugger is preceded by a
  10607.  three-digit number indicating the current thread.
  10608.  
  10609.  Example
  10610.  
  10611.       001>
  10612.  
  10613.  The example above displays the protected-mode CodeView prompt, indicating
  10614.  that thread 1 is the current thread. Thread 1 is always the current thread
  10615.  when you begin a program. If the program never calls the DOSCREATETHREAD
  10616.  function, thread 1 will remain the only thread. Note that certain C library
  10617.  functions (such as BeginThread) call DOSCREATETHREAD for you.
  10618.  
  10619.  Each thread has its own stack and its own register values. When you change
  10620.  the current thread, you see several changes to the CodeView debugger
  10621.  display:
  10622.  
  10623.    ■  The CodeView prompt displays a different three-digit number.
  10624.  
  10625.    ■  The register contents change.
  10626.  
  10627.    ■  The current source line and current instruction both change to reflect
  10628.       the new value of CS:IP. If you are running the debugger in window mode,
  10629.       you are likely to see different code in the display window.
  10630.  
  10631.    ■  The Calls menu and the Stack Trace command displays a different group
  10632.       of functions.
  10633.  
  10634.  
  10635.  12.5  The Thread Command
  10636.  
  10637.  This section discusses the Thread command and lists other CodeView commands
  10638.  that may work differently because of multiple threads.
  10639.  
  10640.  The syntax of the Thread command is displayed below:
  10641.  
  10642.  Syntax
  10643.  
  10644.       ~«specifier«command» »
  10645.  
  10646.  In the syntax display above, the specifier determines to which thread or
  10647.  threads the command applies. You can specify all threads or just a
  10648.  particular thread. The command determines which activity the debugger
  10649.  carries out with regard to the specified thread. For example, you can
  10650.  execute the thread, freeze its execution, or select it as the current
  10651.  thread. If you omit command, the debugger displays the status of the
  10652.  specified thread. If you omit both command and specifier, the debugger
  10653.  displays the status of all threads.
  10654.  
  10655.  The status display for threads consists of the two fields
  10656.  
  10657.       thread-id    thread-state
  10658.  
  10659.  in which thread-id is an integer and thread-state has the value runnable or
  10660.  frozen. All threads not frozen by the debugger are displayed as runnable;
  10661.  this includes threads that may be blocked for reasons that have nothing to
  10662.  do with the debugger, such as a critical section.
  10663.  
  10664.  
  10665.  12.5.1  Legal Values for Specifier
  10666.  
  10667.  The legal values for specifier are listed below along with their effects.
  10668.  
  10669.  Symbol                      Function
  10670.  
  10671.  (blank)                     Displays the status of all threads.
  10672.  
  10673.                              If you omit the specifier field you cannot enter
  10674.                              a command. Instead, you enter the tilde (~) by
  10675.                              itself.
  10676.  
  10677.  #                           Specifies the last thread that was executed.
  10678.  
  10679.                              This thread is not necessarily the current
  10680.                              thread. For example, suppose you are tracing
  10681.                              execution of thread 1, and then switch the
  10682.                              current thread to thread 2. Until you execute
  10683.                              some code in thread 2, the debugger still
  10684.                              considers thread 1 to be the last thread
  10685.                              executed.
  10686.  
  10687.  *                           Specifies all threads.
  10688.  
  10689.  n                           Specifies the indicated thread. The value of n
  10690.                              must be a number corresponding to an existing
  10691.                              thread. You can determine corresponding numbers
  10692.                              for all threads by entering the command ~*,
  10693.                              which gives status of all threads.
  10694.  
  10695.  .                           Specifies the current thread.
  10696.  
  10697.  
  10698.  12.5.2  Legal Values fo rCommand
  10699.  
  10700.  The legal values for command are listed below, along with their effects.
  10701.  
  10702. ╓┌───────────────────────────┌───────────────────────────────────────────────
  10703.  Command                     Function
  10704.  
  10705.  (blank)                     The status of the selected thread (or threads)
  10706.                              is displayed.
  10707.  
  10708.  BP                          A breakpoint is set for the specified thread or
  10709.                              threads.
  10710.  
  10711.                              As explained earlier, it is possible to write
  10712.  Command                     Function
  10713.  
  10714.                             As explained earlier, it is possible to write
  10715.                              your program so that the same function is
  10716.                              executed by more than one thread. By using this
  10717.                              version of the Thread command, you can specify a
  10718.                              breakpoint that applies only to a particular
  10719.                              thread.
  10720.  
  10721.                              The letters BP are followed by normal syntax for
  10722.                              the Breakpoint Set command, as described in
  10723.                              Chapter 7, "Managing Breakpoints." Therefore you
  10724.                              can include the optional pass count and command
  10725.                              fields.
  10726.  
  10727.  E                           The specified thread is executed in slow motion.
  10728.  
  10729.                              When you specify a single thread with E, the
  10730.                              specified thread becomes the current thread and
  10731.                              is executed without any other threads running in
  10732.                              the background. The command ~*E  is a special
  10733.  Command                     Function
  10734.  
  10735.                             the background. The command ~*E  is a special
  10736.                              case.
  10737.  
  10738.                              It is legal only in source mode and executes the
  10739.                              current thread in slow motion, but lets all
  10740.                              other threads run (except those that are
  10741.                              frozen). You see only the current thread
  10742.                              executing in the debugger display.
  10743.  
  10744.  F                           The specified thread (or threads) is frozen.
  10745.  
  10746.                              A frozen thread will not run in the background
  10747.                              or in response to the debugger Go command.
  10748.                              However, if you use the E, G, P, or T variation
  10749.                              of the Thread command, the specified thread is
  10750.                              temporarily unfrozen while the debugger executes
  10751.                              the command.
  10752.  
  10753.  G                           Control is passed to the specified thread until
  10754.  Command                     Function
  10755.  
  10756. G                           Control is passed to the specified thread until
  10757.                              it terminates or until a breakpoint is reached.
  10758.  
  10759.                              If you give the command ~*G, all threads execute
  10760.                              concurrently (except for those that are frozen).
  10761.                              If you specify a particular thread, the debugger
  10762.                              temporarily freezes all other threads and
  10763.                              executes the specified thread.
  10764.  
  10765.  P                           The debugger executes a program step for the
  10766.                              specified thread.
  10767.  
  10768.                              If you specify a particular thread, the debugger
  10769.                              executes one source line or instruction of the
  10770.                              thread. All other threads are temporarily
  10771.                              frozen. This version of the Thread command does
  10772.                              not change the current thread. Therefore if you
  10773.                              specify a thread other than the current thread,
  10774.                              you will not see immediate results. However, the
  10775.  Command                     Function
  10776.  
  10777.                             you will not see immediate results. However, the
  10778.                              subsequent behavior of the current thread may be
  10779.                              affected.
  10780.  
  10781.                              The command ~*P is a special case. It is legal
  10782.                              only in source mode, and causes the debugger to
  10783.                              step to the next source line while letting all
  10784.                              other threads run (except for those that are
  10785.                              frozen). You  see only the current thread
  10786.                              execute in the debugger display.
  10787.  
  10788.  S                           The specified thread is selected as the current
  10789.                              thread.
  10790.  
  10791.                              This version of the Thread command can apply to
  10792.                              only one thread at a time. Thus, the command ~*S
  10793.                              results in an error message. Note that the
  10794.                              command ~.S is legal, but has no effect.
  10795.  
  10796.  Command                     Function
  10797.  
  10798. 
  10799.  T                           The specified thread is traced.
  10800.  
  10801.                              This version of the Thread command works in a
  10802.                              manner identical to P, described above, except
  10803.                              that T traces through function calls and
  10804.                              interrupts, whereas P does not.
  10805.  
  10806.  U                           The specified thread or threads are unfrozen.
  10807.                              This command reverses the effect of a freeze.
  10808.  
  10809.  
  10810.  With the Thread command, only the S (select) and E (execute) variations cause
  10811.  the debugger to switch the current thread. However, when a thread causes
  10812.  program execution to stop by hitting a breakpoint, the debugger selects that
  10813.  thread as the current thread.
  10814.  
  10815.  You can prevent the debugger from changing the current thread by including
  10816.  the breakpoint command "~.S". This command directs the debugger to switch
  10817.  to the current thread rather than the thread that hit the breakpoint. For
  10818.  example, the following command sets a breakpoint at line 120 and prevents
  10819.  the current thread from changing:
  10820.  
  10821.       BP .120 "~.S"
  10822.  
  10823.  
  10824.  12.5.3  Entries to the Thread Command
  10825.  
  10826.  The Thread command can have several possible entries. They are summarized in
  10827.  the syntax display below.
  10828.  
  10829.  Syntax
  10830.  
  10831.       ~{#|*|n|.}«BP|E|F|G|P|S|T|U»
  10832.  
  10833.  Note that you must include one of the symbols from the first set (which
  10834.  gives possible values for the specifier), but you do not have to include a
  10835.  symbol from the second set (which gives possible values for the command).
  10836.  
  10837.  Examples
  10838.  
  10839.       004>~
  10840.  
  10841.  The example above displays the status of all threads, including their
  10842.  corresponding numbers.
  10843.  
  10844.       004>~2
  10845.  
  10846.  The example above displays the status of thread 2.
  10847.  
  10848.       004>~5S
  10849.  
  10850.  The example above selects thread 5 as the current thread. Since the current
  10851.  thread was 4 (a fact apparent from the CodeView prompt), the current thread
  10852.  is changing and therefore the registers and the code displayed can be
  10853.  expected to all change.
  10854.  
  10855.       005>~3BP .64
  10856.  
  10857.  The example above sets a breakpoint at source line 64, an action that stops
  10858.  program execution only when thread 3 executes to this line.
  10859.  
  10860.       005>~1F
  10861.  
  10862.  The example above freezes thread 1.
  10863.  
  10864.       005>~*U
  10865.  
  10866.  The example above thaws (unfreezes) all threads; any threads that were
  10867.  frozen before will now be free to execute whenever the Go command is given.
  10868.  If no threads are frozen, this command has no effect.
  10869.  
  10870.       005>~2E
  10871.  
  10872.  The example above selects thread 2 as the current thread, then proceeds to
  10873.  execute thread 2 in slow motion.
  10874.  
  10875.       002>~3S
  10876.       003>~.F
  10877.       003>~#S
  10878.       002>
  10879.  
  10880.  The example above selects thread 3 as the current thread, freezes the
  10881.  current thread (thread 3), and switches back to thread 2. After switching to
  10882.  thread 3, no code was executed; therefore, the debugger considers the
  10883.  last-thread-executed symbol (#) to refer to thread 2.
  10884.  
  10885.  
  10886.  12.5.4  Effect of Threads on CodeView Commands
  10887.  
  10888.  Whether or not you use the Thread Command, the existence of threads affects
  10889.  your CodeView debugging session at all times. Particular debugger commands
  10890.  are strongly affected. Each of these commands is discussed below.
  10891.  
  10892. ╓┌───────────────────────────┌───────────────────────────────────────────────╖
  10893.  Command                     Behavior in Multiple-Thread Programs
  10894.  
  10895.  .                           The Current Line command always uses the current
  10896.                              value of CS:IP to determine what the current
  10897.                              instruction is. Thus, the Current Line command
  10898.                              applies to the current thread.
  10899.  
  10900.  E                           When the debugger is in source mode, the Execute
  10901.  Command                     Behavior in Multiple-Thread Programs
  10902.  
  10903. E                           When the debugger is in source mode, the Execute
  10904.                              command is equivalent to the ~*E command; the
  10905.                              current thread is executed in slow motion while
  10906.                              all other threads are also running. When the
  10907.                              debugger is in mixed or assembly mode, the
  10908.                              Execute command is equivalent to the command
  10909.                              ~.P, which does not let other threads run
  10910.                              concurrently.
  10911.  
  10912.  BP                          The Set Breakpoint command is equivalent to the
  10913.                              ~*BP command; the breakpoint applies to all
  10914.                              threads.
  10915.  
  10916.  G                           The Go command is equivalent to the ~*G
  10917.                              command; control is passed to the operating
  10918.                              system, which executes all threads in the
  10919.                              program except for those that are frozen.
  10920.  
  10921.  P                           When the debugger is in source mode, the Program
  10922.  Command                     Behavior in Multiple-Thread Programs
  10923.  
  10924. P                           When the debugger is in source mode, the Program
  10925.                              Step command is equivalent to the command ~*P,
  10926.                              which lets other threads run concurrently. When
  10927.                              the debugger is in mixed or assembly mode, the
  10928.                              Program Step command is equivalent to the
  10929.                              command ~.P, which lets no other threads run.
  10930.  
  10931.  K                           The Stack Trace command displays the stack of
  10932.                              the current thread.
  10933.  
  10934.  T                           When the debugger is in source mode, the Trace
  10935.                              command is equivalent to the command ~*T, which
  10936.                              lets other threads run concurrently. When the
  10937.                              debugger is in mixed or assembly mode, the Trace
  10938.                              command is equivalent to the command ~.T, which
  10939.                              lets no other threads run.
  10940.  
  10941.  
  10942.  In general, CodeView commands apply to all threads unless the nature of the
  10943.  command makes it appropriate to deal with only one thread at a time. In this
  10944.  case, the command applies only to the current thread. (For example, since
  10945.  each thread has its own stack, the Stack Trace command does not apply to all
  10946.  threads.)
  10947.  
  10948.  
  10949.  ───────────────────────────────────────────────────────────────────────────
  10950.  Part 2  Utilities
  10951.  
  10952.  Part 2 describes the use of each of the DOS and OS/2 programming utilities
  10953.  (exit codes and messages for these utilities are presented in the
  10954.  appendixes).
  10955.  
  10956.  Some of the material is this part, most notably the information on LINK, is
  10957.  presented in partial form in the user's guides for Microsoft compilers.
  10958.  However, you will find here the only complete, authoritative reference on
  10959.  utility operation and available options.
  10960.  
  10961.  Chapters 13-17 document utilities you can use to produce either OS/2 or DOS
  10962.  programs. Chapters 18-22 document utilities and special concepts-such as
  10963.  module-definition files-developed specifically for the creation of OS/2
  10964.  programs.
  10965.  
  10966.  
  10967.  Chapter 13  Linking Object Files with LINK
  10968.  ───────────────────────────────────────────────────────────────────────────
  10969.  
  10970.  The Microsoft Segmented-Executable Linker (LINK) is used to combine object
  10971.  files into a single executable file. It can be used with object files
  10972.  compiled or assembled for 8086/8088, 80286, or 80386 machines. The format of
  10973.  input to the linker is the Microsoft Relocatable Object-Module Format (OMF),
  10974.  which is based on the Intel 8086 OMF.
  10975.  
  10976.  The output file from LINK (that is, the executable file) is not bound to
  10977.  specific memory addresses. Thus, the operating system can load and execute
  10978.  this file at any convenient address. LINK can produce executable files
  10979.  containing up to 1 megabyte of code and data.
  10980.  
  10981.  The following sections explain how to run the linker and specify options
  10982.  that control its operation.
  10983.  
  10984.  
  10985.  13.1  Determining Linker Output
  10986.  
  10987.  The linker can produce either an application that runs under real mode (DOS
  10988.  2.x, 3.x, or 3.x compatibility box), an application that runs under OS/2
  10989.  protected mode (or Microsoft Windows), or an OS/2 dynamic-link library. If
  10990.  you are developing programs for real mode only, leave the deffile field on
  10991.  the LINK command line empty and ignore the following discussion. If you are
  10992.  developing programs for OS/2, read this section to understand what kind of
  10993.  executable file the linker produces. Chapters 18 and 19 explain in detail
  10994.  the terms and concepts mentioned below.
  10995.  
  10996.  The following rules determine what output the linker produces:
  10997.  
  10998.    1. If no module-definition file or import library resolves any external
  10999.       references, the linker produces a real-mode application. (In other
  11000.       words, the linker creates a real-mode application unless you specify a
  11001.       module-definition file or import library, and that file or library
  11002.       resolves at least one external reference.)
  11003.  
  11004.    2. If a module-definition file with a LIBRARY statement is given, the
  11005.       linker produces a dynamic-link library for OS/2 protected mode or
  11006.       Windows.
  11007.  
  11008.    3. Otherwise, the linker produces an application for OS/2 protected mode
  11009.       or Windows.
  11010.  
  11011.  You can therefore produce an OS/2 protected-mode application by linking with
  11012.  an import library or a module-definition file, as long as you do not use a
  11013.  LIBRARY statement. (The LIBRARY statement is described in Chapter 19,
  11014.  "Using Module-Definition Files.") The file DOSCALLS.LIB is an import
  11015.  library. Therefore, if you link with DOSCALLS.LIB, you produce either an
  11016.  OS/2 application or a dynamic-link library.
  11017.  
  11018.  When you use a Microsoft high-level language to compile for protected mode,
  11019.  it automatically specifies DOSCALLS.LIB as a default library.
  11020.  
  11021.  ───────────────────────────────────────────────────────────────────────────
  11022.  NOTE
  11023.     Throughout this chapter, all references to OS/2 protected mode also apply
  11024.     to Microsoft Windows. Other chapters may make a distinction between
  11025.     protected mode and Windows. Each reference to "library," unless otherwise
  11026.     noted, refers to a standard (object-code) library, not a dynamic-link
  11027.     library.
  11028.  ───────────────────────────────────────────────────────────────────────────
  11029.  
  11030.  The linker produces files that run in protected mode only or in real mode
  11031.  only. However, OS/2 applications that make dynamic-link calls only to the
  11032.  Family API (a subset of the functions defined in DOSCALLS.LIB) can be made
  11033.  to run under DOS 3.x with the BIND utility. (BIND is discussed in Chapter
  11034.  20).
  11035.  
  11036.  
  11037.  
  11038.  13.2  Specifying Files for Linking
  11039.  
  11040.  Instead of using high-level-language commands to invoke the linker, you can
  11041.  use the LINK command to invoke LINK directly.You can specify the input
  11042.  required for this command in one of three ways:
  11043.  
  11044.    1. By placing it on the command line.
  11045.  
  11046.    2. By responding to prompts.
  11047.  
  11048.    3. By specifying a file containing responses to prompts. This type of file
  11049.       is known as a "response file."
  11050.  
  11051.  Regardless of the way in which LINK was invoked, press CTRL+C at any time to
  11052.  terminate LINK operation and exit back to DOS.
  11053.  
  11054.  
  11055.  13.2.1  Specifying File Names
  11056.  
  11057.  You can use any combination of uppercase and lowercase letters for the file
  11058.  names you specify on the LINK command line or give in response to the LINK
  11059.  command prompts. For example, LINK considers the following three file names
  11060.  to be equivalent:
  11061.  
  11062.       abcde.fgh
  11063.       AbCdE.FgH
  11064.       ABCDE.fgh
  11065.  
  11066.  If you specify file names without extensions, LINK uses the following
  11067.  default file-name extensions:
  11068.  
  11069.  File Type                   Default Extension
  11070.  
  11071.  Object                      .OBJ
  11072.  
  11073.  Executable                  .EXE
  11074.  
  11075.  Map                         .MAP
  11076.  
  11077.  Library                     .LIB
  11078.  
  11079.  Module definition           .DEF
  11080.  (protected-mode use
  11081.  only)
  11082.  
  11083.  You can override the default extension for a particular command-line field
  11084.  or prompt by specifying a different extension. To enter a file name that has
  11085.  no extension, type the name followed by a period.
  11086.  
  11087.  Examples
  11088.  
  11089.  Consider the following two file specifications:
  11090.  
  11091.       ABC.
  11092.       ABC
  11093.  
  11094.  If you use the first file specification, LINK assumes that the file has no
  11095.  extension. If you use the second file specification, LINK uses the default
  11096.  extension for that prompt.
  11097.  
  11098.  
  11099.  13.2.2  Linking with the LINK Command Line
  11100.  
  11101.  Use the following form of the LINK command to specify input on the command
  11102.  line:
  11103.  
  11104.       LINK objfiles«,«exefile»«,«mapfile»«,«libraries»«,deffile;
  11105.  
  11106.  Each of the command-line fields is explained below. In these explanations,
  11107.  reference is made to libraries. Unless qualified by the term "dynamic-link,"
  11108.  the word "libraries" refers to import libraries and standard (object-code)
  11109.  libraries, both of which have the default extension .LIB. (Note that
  11110.  dynamic-link libraries have the default extension .DLL, and therefore are
  11111.  usually easy to distinguish from other libraries.) You can specify import
  11112.  libraries anywhere you can specify standard libraries.You can also combine
  11113.  import libraries and standard libraries by using the Library Manager; these
  11114.  combined libraries can then be specified in place of standard libraries.
  11115.  
  11116.  The objfiles field
  11117.  
  11118.  The objfiles field allows you to specify the names of the object files you
  11119.  are linking. At least one object-file name is required. A space or plus sign
  11120.  (+) must separate each pair of object-file names. LINK automatically
  11121.  supplies the .OBJ extension when you give a filename without an extension.
  11122.  If your object file has a different extension, or if it appears in another
  11123.  directory or on another disk, you must give the full name──including the
  11124.  extension and path name──for the file to be found. If LINK cannot find a
  11125.  given object file, and the drive associated with the object file is a
  11126.  removable (floppy) drive, LINK displays a message and waits for you to
  11127.  change disks.
  11128.  
  11129.  You may also specify one or more libraries in the objfiles field. To enter a
  11130.  library in this field, make sure that you include the .LIB extension;
  11131.  otherwise LINK assumes an .OBJ extension. Libraries entered in this field
  11132.  are called "load libraries" as opposed to "regular libraries." LINK
  11133.  automatically links in every object module in a load library; it does not
  11134.  search for unresolved external references first. The effect of entering a
  11135.  load library is exactly the same as if you had entered all the names of the
  11136.  library's object modules into the objfiles field. This feature is useful if
  11137.  you are developing software using many modules and wish to avoid having to
  11138.  retype each module on the LINK command line.
  11139.  
  11140.  The exefile field
  11141.  
  11142.  The exefile field allows you to specify the name of the executable file. If
  11143.  the file name you give does not have an extension, LINK automatically adds
  11144.  .EXE as the extension. You can give any file name you like; however, if you
  11145.  are specifying an extension, you should always use .EXE because DOS expects
  11146.  executable files to have either this extension or the .COM extension.
  11147.  
  11148.  The mapfile field
  11149.  
  11150.  The mapfile field allows you to specify the name of the map file if you are
  11151.  creating one. To include public symbols and their addresses in the map file,
  11152.  specify the /MAP option on the LINK command line. (See Section 13.3.15,
  11153.  "Listing Public Symbols.") If  you specify a map-filename without an
  11154.  extension, LINK automatically adds an extension of .MAP. LINK creates the
  11155.  map file in the current working directory unless you specify a path name for
  11156.  the map file.
  11157.  
  11158.  The libraries field
  11159.  
  11160.  The libraries field allows you to specify the name of a library that you
  11161.  want linked to the object file(s). (When LINK finds the name of a library in
  11162.  this field, the library is a "regular library," and LINK will link in only
  11163.  those object modules needed to resolve external references.) Each time you
  11164.  compile a source file for a high-level language, the compiler places the
  11165.  name of one or more libraries in the object file that it creates; the linker
  11166.  automatically searches for a library with this name. Because of this, you do
  11167.  not need to give library names on the LINK command line unless you want to
  11168.  add the names of other libraries, search for libraries in different
  11169.  locations, or override the use of the library named in the object file.
  11170.  
  11171.  The deffile field
  11172.  
  11173.  The deffile field allows you to specify the file name of a module-definition
  11174.  file. Leave this field blank if you are linking for real mode. The use of a
  11175.  module-definition file is optional for applications, but required for
  11176.  dynamic-link libraries. See Chapters 18 and 19 for more information on
  11177.  module-definition files.
  11178.  
  11179.  You may specify command-line options after any field──but before the comma
  11180.  that terminates the field. The options are described in sections
  11181.  13.3.1-13.3.32. You do not have to give any options when you run the
  11182.  linker.
  11183.  
  11184.  If you include a comma (to indicate where a field would be) but do not put a
  11185.  file name before the comma, LINK will select the default for that field.
  11186.  However, if you use a comma to include the mapfile field (but do not include
  11187.  a name), LINK creates a map file. This file has the same base name as the
  11188.  executable file. Use NUL for the map-filename if you do not want to produce
  11189.  a map file.
  11190.  
  11191.  You can also select default responses by using a semicolon (;). The
  11192.  semicolon tells LINK to use the defaults for all remaining fields. If you do
  11193.  not give all file names on the command line, or if you do not end the
  11194.  command line with a semicolon, the linker prompts you for the files you
  11195.  omitted, using the prompts described in Section 13.2.3, "Linking with the
  11196.  LINK Prompts."
  11197.  
  11198.  If you do not specify a drive or directory for a file, the linker assumes
  11199.  that the file is on the current drive and directory. If you want the linker
  11200.  to create files in a location other than the current drive and directory,
  11201.  you must specify the new drive and directory for each such file on the
  11202.  command line.
  11203.  
  11204.  ───────────────────────────────────────────────────────────────────────────
  11205.  NOTE
  11206.     The OS/2 linker supports overlays only when producing a real-mode
  11207.     application.
  11208.  ───────────────────────────────────────────────────────────────────────────
  11209.  
  11210.  Examples
  11211.  
  11212.       LINK FUN+TEXT+TABLE+CARE, ,FUNLIST, XLIB.LIB
  11213.  
  11214.  The command line above causes LINK to load and link the object modules
  11215.  FUN.OBJ, TEXT.OBJ, TABLE.OBJ, and CARE.OBJ, and to search for unresolved
  11216.  references in the library file XLIB.LIB and the default libraries. By
  11217.  default, the executable file produced byLINK is named FUN.EXE. LINK also
  11218.  produces a map file, FUNLIST.MAP.
  11219.  
  11220.       LINK FUN,,;
  11221.  
  11222.  This command line produces a map file named FUN.MAP since a comma appears as
  11223.  a placeholder for the mapfile specification on the command line.
  11224.  
  11225.       LINK FUN,;
  11226.       LINK FUN;
  11227.  
  11228.  These command lines do not produce a map file, since commas do not appear as
  11229.  placeholders for the mapfile specification.
  11230.  
  11231.       LINK MAIN+GETDATA+PRINTIT, , MAIN;
  11232.  
  11233.  The command in the line above causes LINK to link the files MAIN.OBJ,
  11234.  GETDATA.OBJ, and PRINTIT.OBJ into a real-mode executable file since there is
  11235.  no module-definition file. A map file named  MAIN.MAP is also produced.
  11236.  
  11237.       LINK GETDATA+PRINTIT, , , MODDEF
  11238.  
  11239.  This command causes LINK to link GETDATA.OBJ andPRINTIT.OBJ into an OS/2
  11240.  dynamic-link library if MODDEF.DEF contains a LIBRARY statement. Otherwise,
  11241.  an OS/2 protected-mode application is produced.
  11242.  
  11243.  
  11244.  13.2.3  Linking with the LINK Prompts
  11245.  
  11246.  If you want to use the LINK prompts to specify input to the linker, start
  11247.  the linker by typing LINK at the DOS command level. LINK prompts you for the
  11248.  input it needs by displaying the following lines, one at a time:
  11249.  
  11250.       Object Modules [.OBJ]:
  11251.       Run File [basename.EXE]:
  11252.       List File [NUL.MAP]:
  11253.       Libraries [.LIB]:
  11254.       Definitions File [NUL.DEF]:
  11255.  
  11256.  LINK waits for you to respond to each prompt before printing the next one.
  11257.  Section 13.2.1 gives the rules for specifying file names in response to
  11258.  these prompts.
  11259.  
  11260.  The responses you give to the LINK command prompts correspond to the fields
  11261.  on the LINK command line. (See Section 13.2.2 for a discussion of the LINK
  11262.  command line.) The following list shows these correspondences:
  11263.  
  11264.  Prompt                      Command-Line Fields
  11265.  
  11266.  Object Module               objfiles
  11267.  
  11268.  Run File                    exefile
  11269.  
  11270.  List File                   mapfile
  11271.  
  11272.  Libraries                   libraries
  11273.  
  11274.  Definitions File            deffile
  11275.  
  11276.  If a plus sign (+) is the last character you type on a response line, the
  11277.  prompt appears on the next line, and you can continue typing responses. In
  11278.  this case, the plus sign must appear at the end of a complete file or
  11279.  library name, path name, or drive name.
  11280.  
  11281.  To select the default response to the current prompt, type a carriage return
  11282.  without giving a file name. The next prompt will appear.
  11283.  
  11284.  To select default responses to the current prompt and all remaining prompts,
  11285.  type a semicolon (;) followed immediately by a carriage return. After you
  11286.  enter a semicolon, you cannot respond to any of the remaining prompts for
  11287.  that link session. Use this option to save time when you want to use the
  11288.  default responses. However, you cannot enter a semicolon in response to the
  11289.  Object Modules prompt, because there is no default response for that prompt.
  11290.  
  11291.  The following list shows the defaults for the other linker prompts:
  11292.  
  11293.  Prompt                      Default
  11294.  
  11295.  Run File                    The name of the first object file submitted for
  11296.                              the Object modules prompt, with the .EXE
  11297.                              extension replacing the .OBJ extension
  11298.  
  11299.  List File                   The special file name NUL.MAP, which tells LINK
  11300.                              not to create a map file
  11301.  
  11302.  Libraries                   The default libraries encoded in the object
  11303.                              module (see Section 13.2.5, "How LINK Searches
  11304.                              for Libraries")
  11305.  
  11306.  Definitions File            The special file name NUL.DEF, which tells LINK
  11307.                              not to use a definitions file
  11308.  
  11309.  
  11310.  13.2.4  Linking with a Response File
  11311.  
  11312.  To operate the linker with a response file, you must set up the response
  11313.  file and type the following:
  11314.  
  11315.       LINK @responsefile
  11316.  
  11317.  Here responsefile specifies the name or pathname of the response file that
  11318.  starts the linker. You can also enter the name of a response file after any
  11319.  LINK command prompt or at any position in the LINK command line.
  11320.  
  11321.  A response file contains responses to the LINK prompts. The responses must
  11322.  be in the same order as the LINK prompts discussed in Section 13.2.3. Each
  11323.  new response must appear on a new line or begin with a comma; however, you
  11324.  can extend long responses across more than one line by typing a plus sign
  11325.  (+) as the last character of each incomplete line. You may give options at
  11326.  the end of any response or place them on one or more separate lines.
  11327.  
  11328.  LINK treats the input from the response file just as if you had entered it
  11329.  in response to prompts or in a command line. It treats any carriage-return
  11330.  and line-feed combination in the response file the same as if you had
  11331.  pressed ENTER in response to a prompt or included a comma in a command line.
  11332.  
  11333.  You can use options and command characters in the response file in the same
  11334.  way as you would in responses you type at the keyboard. For example, if you
  11335.  type a semicolon on the line of the response file corresponding to the Run
  11336.  File prompt, LINK uses the default responses for the executable file and for
  11337.  the remaining prompts.
  11338.  
  11339.  When you enter the LINK command with a response file, each LINK prompt is
  11340.  displayed on your screen with the corresponding response from your response
  11341.  file. If the response file does not include a line with a file name,
  11342.  semicolon, or carriage return for each prompt, LINK displays the appropriate
  11343.  prompt and waits for you to enter a response. When you type an acceptable
  11344.  response, LINK continues.
  11345.  
  11346.  Example
  11347.  
  11348.  Assume that the following response file is named FUN.LNK:
  11349.  
  11350.       FUN TEXT TABLE CARE
  11351.       /PAUSE /MAP
  11352.       FUNLIST
  11353.       GRAF.LIB
  11354.  
  11355.  You can type the following command to run LINK and tell it to use the
  11356.  responses in FUN.LNK:
  11357.  
  11358.       LINK @FUN.LNK
  11359.  
  11360.  The response file tells LINK to load the four object modules FUN, TEXT,
  11361.  TABLE, and CARE. LINK produces an executable file named FUN.EXE and a map
  11362.  file named FUNLIST.MAP. The /PAUSE option tells LINK to pause before it
  11363.  produces the executable file so you can swap disks, if necessary. The /MAP
  11364.  option tells LINK to include public symbols and addresses in the map file.
  11365.  LINK also links any needed routines from the library file GRAF.LIB. See the
  11366.  discussions of the /PAUSE and /MAP options in Sections 13.3.28 and
  11367.  13.3.15, respectively, for more information about these options.
  11368.  
  11369.  
  11370.  13.2.5  How LINK Searches for Libraries
  11371.  
  11372.  The material in this section does not apply to libraries that LINK finds in
  11373.  the objectfiles field, either on the command line or in response to the
  11374.  Object Modules prompt. Those libraries are treated simply as a series of
  11375.  object files, and LINK does not conduct extensive searches in such cases.
  11376.  
  11377.  LINK may be directed to find a particular library by the user (who specifies
  11378.  a library in the libraries field) or by an object module. (When a compiler
  11379.  creates an object module from a higher-level-language program, that object
  11380.  module will contain the names of one or more "default" libraries.) However
  11381.  the linker is directed to a library, LINK uses the same method for finding
  11382.  that library.
  11383.  
  11384.  If the library name includes a path specification, LINK searches only that
  11385.  directory for the library. Libraries specified by object modules (that is,
  11386.  default libraries) will normally not include a path specification.
  11387.  
  11388.  If a library name is given without a path specification, LINK searches in
  11389.  the following three locations to find the given library file:
  11390.  
  11391.    1. The current working directory
  11392.  
  11393.    2. Any path specifications or drive names that you give on the command
  11394.       line or type in response to the Libraries prompt, in the order in which
  11395.       they appear (see Section 13.2.3)
  11396.  
  11397.    3. The locations given by the LIB environment variable
  11398.  
  11399.  Because object files created by compilers and assemblers usually contain the
  11400.  names of all the standard libraries you need, you are not required to
  11401.  specify a library on the LINK command line or in response to the LINK
  11402.  Libraries prompt unless you want to do one of the following:
  11403.  
  11404.    ■  Add the names of additional libraries to be searched
  11405.  
  11406.    ■  Search for libraries in different locations
  11407.  
  11408.    ■  Override the use of one or more default libraries
  11409.  
  11410.  For example, if you have developed your own customized libraries, you might
  11411.  want to include one or more of them as additional libraries at linking time.
  11412.  
  11413.  Searching Additional Libraries
  11414.  
  11415.  You can tell LINK to search additional libraries by specifying one or more
  11416.  library files on the command line or in response to the Libraries prompt.
  11417.  LINK searches these libraries before it searches default libraries. It
  11418.  searches these libraries in the order you specify.
  11419.  
  11420.  LINK automatically supplies the .LIB extension if you omit it from a
  11421.  library-file name. If you want to link a library file that has a different
  11422.  extension, be sure to specify the extension.
  11423.  
  11424.  Searching Different Locations for Libraries
  11425.  
  11426.  You can tell LINK to search additional locations for libraries by giving a
  11427.  drive name or path specification in the libraries field on the command line
  11428.  or in response to the Libraries prompt. You can specify up to 32 additional
  11429.  paths. If you give more than 32 paths, LINK ignores the additional paths
  11430.  without displaying an error message.
  11431.  
  11432.  Overriding Libraries Named in Object Files
  11433.  
  11434.  If you do not want to link with the library whose name is included in the
  11435.  object file, you can give the name of a different library instead. You might
  11436.  want to specify a different library name in the following cases:
  11437.  
  11438.    ■  If you assigned a "custom" name to a standard library when you set up
  11439.       your libraries
  11440.  
  11441.    ■  If you want to link with a library that supports a different math
  11442.       package other than the math package you gave on the compiler command
  11443.       line (or the default)
  11444.  
  11445.  If you specify a new library name on the LINK command line, the linker
  11446.  searches the new library to resolve external references before it searches
  11447.  the library specified in the object file.
  11448.  
  11449.  If you want the linker to ignore the library whose name is included in the
  11450.  object file, use the /NOD option. This option tells LINK to information that
  11451.  is encoded in the object files created by high-level-language compilers. Use
  11452.  this option with caution; see the discussion of the /NOD option in Section
  11453.  13.3.16 for more information.
  11454.  
  11455.  Example
  11456.  
  11457.       LINK
  11458.  
  11459.       Object Modules [.OBJ]: FUN TEXT TABLE CARE
  11460.       Run File [FUN.EXE]:
  11461.       List File [NUL.MAP]:
  11462.       Libraries [.LIB]: C:\TESTLIB\ NEWLIBV3
  11463.  
  11464.  This example links four object modules to create an executable file named
  11465.  FUN.EXE. LINK searches NEWLIBV3.LIB before searching the default libraries
  11466.  to resolve references. To locate NEWLIBV3.LIB and the default libraries,
  11467.  the linker searches the current working directory, then the C:\TESTLIB\
  11468.  directory, and finally the locations given by the LIB environment variable.
  11469.  
  11470.  
  11471.  13.2.6  LINK Memory Requirements
  11472.  
  11473.  LINK uses available memory for the link session. If the files to be linked
  11474.  create an output file that exceeds available memory, LINK creates a
  11475.  temporary disk file to serve as memory. This temporary file is handled in
  11476.  one of the following ways, depending on the DOS version:
  11477.  
  11478.    ■  The linker will use the directory specified by the TMP environment
  11479.       variable, for the purpose of creating a temporary file. For example, if
  11480.       the TMP variable were set to C:\TEMPDIR, LINK would put the temporary
  11481.       file in C:\TEMPDIR.
  11482.  
  11483.       If there is no TMP environment variable, or if the directory specified
  11484.       by TMP does not exist, then LINK will put the temporary file in the
  11485.       current working directory.
  11486.  
  11487.    ■  If the linker is running on DOS Version 3.0 or later, it uses a DOS
  11488.       system call to create a temporary file with a unique name in the
  11489.       temporary-file directory.
  11490.  
  11491.    ■  If the linker is running on a version of DOS prior to 3.0, it creates a
  11492.       temporary file named VM.TMP.
  11493.  
  11494.  When the linker creates a temporary disk file, you see the message
  11495.  
  11496.       Temporary file tempfile has been created.
  11497.       Do not change diskette in drive, letter.
  11498.  
  11499.  In the message displayed above, tempfile is ".\" followed by either VM.TMP
  11500.  or a name generated by DOS, and letter is the drive containing the
  11501.  temporary file.
  11502.  
  11503.  The message Do not change diskette in drive will not appear unless the drive
  11504.  is a removable disk. After this message appears, do not remove the disk from
  11505.  the drive specified by letter until the link session ends. If the disk is
  11506.  removed, the operation of LINK is unpredictable, and you may see the
  11507.  following message:
  11508.  
  11509.       Unexpected end-of-file on scratch file
  11510.  
  11511.  When this happens, rerun the link session. The temporary file created by
  11512.  LINK is a working file only. LINK deletes it at the end of the link session.
  11513.  
  11514.  ───────────────────────────────────────────────────────────────────────────
  11515.  NOTE
  11516.     Do not give any of your own files the name VM.TMP. The linker displays an
  11517.     error message if it encounters an existing file with this name.
  11518.  ───────────────────────────────────────────────────────────────────────────
  11519.  
  11520.  
  11521.  13.3  Specifying Linker Options
  11522.  
  11523.  This section explains how to use linker options to specify and control the
  11524.  tasks performed by LINK. All options begin with the linker's option
  11525.  character, the forward slash (/).
  11526.  
  11527.  When you use the LINK command line to invoke LINK, options can appear at the
  11528.  end of the line or after individual fields on the line. However, they must
  11529.  precede the comma that separates each field from the next.
  11530.  
  11531.  If you respond to the individual prompts for the LINK command, you can
  11532.  specify linker options at the end of any response. When you specify more
  11533.  than one option, you can either group the options at the end of a single
  11534.  response or distribute the options among several responses. Every option
  11535.  must begin with the slash character (/), even if other options precede it on
  11536.  the same line. Similarly, in a response file, options can appear on a line
  11537.  by themselves or after individual response lines.
  11538.  
  11539.  Abbreviations
  11540.  
  11541.  Since linker options are named according to their functions, some of these
  11542.  names are quite long. You can abbreviate the options to save space and
  11543.  effort. Be sure that your abbreviation is unique so the linker can determine
  11544.  which option you want. (The minimum legal abbreviation for each option is
  11545.  indicated in the syntax description of the option.)
  11546.  
  11547.  Abbreviations must begin with the first letter of the option and must be
  11548.  continuous through the last letter typed. No gaps or transpositions are
  11549.  allowed. Options may be entered as uppercase or lowercase.
  11550.  
  11551.  Numerical Arguments
  11552.  
  11553.  Some linker options take numeric arguments. A numeric argument can be any of
  11554.  the following:
  11555.  
  11556.    ■  A decimal number from 0 to 65,535.
  11557.  
  11558.    ■  An octal number from 0 to 177,777. A number is interpreted as octal if
  11559.       it starts with 0. For example, the number 10 is interpreted as a
  11560.       decimal number, but the number 010 is interpreted as an octal number,
  11561.       equivalent to 8 in decimal.
  11562.  
  11563.    ■  A hexadecimal number from 0 to FFFF. A number is interpreted as
  11564.       hexa-decimal if it starts with 0X. For example, 0X10 is a hexadecimal
  11565.       number, equivalent to 16 in decimal.
  11566.  
  11567.  
  11568.  13.3.1  Aligning Segment Data (/A)
  11569.  
  11570.  Option
  11571.  
  11572.       /A«LIGNMENT»:size
  11573.  
  11574.  The ALIGNMENT option directs LINK to align segment data in the executable
  11575.  file along the boundaries specified by size. The size argument must be a
  11576.  power of two. For example,
  11577.  
  11578.       /ALIGNMENT:16
  11579.  
  11580.  indicates an alignment boundary of 16 bytes. The default alignment for
  11581.  OS/2-application and dynamic-link segments is 512. This option is used for
  11582.  linking Windows applications or protected-mode programs.
  11583.  
  11584.  
  11585.  13.3.2  Running in Batch Mode (/BA)
  11586.  
  11587.  Option
  11588.  
  11589.       /BA«TCH»
  11590.  
  11591.  By default, the linker prompts you for a new path name whenever it cannot
  11592.  find a library it has been directed to use. It also prompts you if it cannot
  11593.  find an object file, and it expects that file to be on a removable disk. If
  11594.  the /BA option is used, however, the linker will not prompt you for any
  11595.  libraries or object files it cannot find. Instead, the linker will generate
  11596.  an error or warning message, if appropriate. The /BA option also prevents
  11597.  LINK from printing the sign-on banner and echoing input from response files.
  11598.  
  11599.  Using this option can cause unresolved external references. It is intended
  11600.  primarily for users who use batch or MAKE files for linking many executable
  11601.  files with a single command, and who wish to prevent linker operation from
  11602.  halting.
  11603.  
  11604.  ───────────────────────────────────────────────────────────────────────────
  11605.  NOTE
  11606.     This option does not prevent the linker from prompting for command-line
  11607.     arguments. You can prevent such prompting only by using a semicolon on
  11608.     the command line.
  11609.  ───────────────────────────────────────────────────────────────────────────
  11610.  
  11611.  
  11612.  13.3.3  Producing a .COM File (/BI)
  11613.  
  11614.       /BI«NARY»
  11615.  
  11616.  The /BI option directs the linker to produce a .COM file instead of an .EXE
  11617.  file. Not every program can be produced in the .COM format. The following
  11618.  restrictions apply:
  11619.  
  11620.    1. The program must consist of only one physical segment. If you have
  11621.       written an assembly-language program, you can declare more than one
  11622.       segment; however, the segments must be in the same group.
  11623.  
  11624.    2. The code must have no far-segment references.
  11625.  
  11626.       Specifically, segment addresses cannot be used as immediate data for
  11627.       instructions. You could not, for example, use the following
  11628.       instruction:
  11629.  
  11630.           mov     ax,CODESEG
  11631.  
  11632.    3. Programs for the Windows and OS/2 protected-mode environments cannot be
  11633.       converted to .COM file.
  11634.  
  11635.  When you use the /BI option, the default file extension of the output file
  11636.  is .COM rather than .EXE.
  11637.  
  11638.  
  11639.  13.3.4  Preparing for Debugging (/CO)
  11640.  
  11641.  Option
  11642.  
  11643.       /CO«DEVIEW»
  11644.  
  11645.  The /CO option is used to prepare for debugging with the CodeView
  11646.  window-oriented debugger. This option tells the linker to prepare a special
  11647.  executable file containing symbolic data and line-number information.
  11648.  
  11649.  You can run this executable file outside the CodeView debugger; the extra
  11650.  data in the file will be ignored. However, to keep file size to a minimum,
  11651.  use the special-format executable file only for debugging. You can then link
  11652.  a separate version without the /CO option after the program is debugged.
  11653.  
  11654.  
  11655.  13.3.5  Setting the Maximum Allocation Space (/CP)
  11656.  
  11657.  Option
  11658.  
  11659.       /CP«ARMAXALLOC»:number
  11660.  
  11661.  The /CP option sets the maximum number of 16-byte paragraphs needed by the
  11662.  program when it is loaded into memory. The operating system uses this value
  11663.  when allocating space for the program before loading it. The option is
  11664.  useful when you want to execute another program from within your program and
  11665.  you need to reserve space for the executed program. This option is valid
  11666.  only when linking real-mode programs.
  11667.  
  11668.  LINK normally requests the operating system to set the maximum number of
  11669.  paragraphs to 65,535. Since this represents more memory than could be
  11670.  available under DOS, the operating system always denies the request and
  11671.  allocates the largest contiguous block of memory it can find. If the /CP
  11672.  option is used, the operating system allocates no more space than the option
  11673.  specified. This means any additional space in memory is free for other
  11674.  programs.
  11675.  
  11676.  The number can be any integer value in the range 1 to 65,535. If number is
  11677.  less than the minimum number of paragraphs needed by the program, LINK
  11678.  ignores your request and sets the maximum value equal to whatever the
  11679.  minimum value happens to be. The minimum number of paragraphs needed by a
  11680.  program is never less than the number of paragraphs of code and data in the
  11681.  program. To free more memory for programs compiled in the medium- and
  11682.  large-memory models, link with /CP:1; this leaves no space for the near
  11683.  heap.
  11684.  
  11685.  ───────────────────────────────────────────────────────────────────────────
  11686.  NOTE
  11687.     You can change the maximum allocation after linking by using the EXEMOD
  11688.     utility, which modifies the executable-file header, as described in
  11689.     Section 17.1. The format of the executable-file header is also discussed
  11690.     in that section, as well as in the Microsoft MS-DOS Programmer's
  11691.     Reference and in other reference books on DOS.
  11692.  ───────────────────────────────────────────────────────────────────────────
  11693.  
  11694.  
  11695.  13.3.6  Ordering Segments (/DO)
  11696.  
  11697.  Option
  11698.  
  11699.       /DO«SSEG»
  11700.  
  11701.  The /DO option is automatically enabled by a special object-module record in
  11702.  Microsoft language libraries. If you are linking to one of these libraries,
  11703.  you do not need to specify this option.
  11704.  
  11705.  This option is also enabled by assembly modules that use the Microsoft Macro
  11706.  Assembler directive .DOSSEG.
  11707.  
  11708.  The /DO option forces segments to be ordered as follows:
  11709.  
  11710.    1. All segments with a class name ending in CODE
  11711.  
  11712.    2. All other segments outside DGROUP
  11713.  
  11714.    3. DGROUP segments, in the following order:
  11715.  
  11716.       a.   Any segments of class BEGDATA (this class name reserved for
  11717.            Microsoft use)
  11718.  
  11719.       b.   Any segments not of class BEGDATA, BSS, or STACK
  11720.  
  11721.       c.   Segments of class BSS
  11722.  
  11723.       d.   Segments of class STACK
  11724.  
  11725.  Note that when the /DO option is in effect the linker initializes two
  11726.  special variables as follows:
  11727.  
  11728.       _edata = DGROUP : BSS
  11729.       _end   = DGROUP : STACK
  11730.  
  11731.  The variables _edata and _end have special meanings for the Microsoft C and
  11732.  FORTRAN compilers, so it is not wise to give these names to your own program
  11733.  variables. Assembly modules can reference these variables but should not
  11734.  change them.
  11735.  
  11736.  
  11737.  13.3.7  Controlling Data Loading (/DS)
  11738.  
  11739.  Option
  11740.  
  11741.       /DS«ALLOCATE»
  11742.  
  11743.  By default, LINK loads all data starting at the low end of the data segment.
  11744.  At run time, the data segment (DS) register is set to the lowest possible
  11745.  address to allow the entire data segment to be used. This option is valid
  11746.  only when linking real-mode programs.
  11747.  
  11748.  Use the /DS option to tell LINK to load all data starting at the high end of
  11749.  the data segment instead. In this case, the DS register is set at run time
  11750.  to the lowest data-segment address that contains program data.
  11751.  
  11752.  The /DS option is typically used with the /HI option, discussed in Section
  11753.  13.3.11, to take advantage of unused memory within the data segment.
  11754.  
  11755.  ───────────────────────────────────────────────────────────────────────────
  11756.  WARNING
  11757.     This option should be used only with assembly-language programs.
  11758.  ───────────────────────────────────────────────────────────────────────────
  11759.  
  11760.  
  11761.  13.3.8  Packing Executable Files (/E)
  11762.  
  11763.  Option
  11764.  
  11765.       /E«XEPACK»
  11766.  
  11767.  The /E option directs LINK to remove sequences of repeated bytes (typically
  11768.  null characters) and to optimize the load-time-relocation table before
  11769.  creating the executable file. (The load-time-relocation table is a table of
  11770.  references relative to the start of the program, each of which changes when
  11771.  the executable image is loaded into memory and an actual address for the
  11772.  entry point is assigned.)
  11773.  
  11774.  Executable files linked with this option may be smaller, and thus load
  11775.  faster, than files linked without this option. However, you cannot use the
  11776.  Symbolic Debug Utility (SYMDEB) or the CodeView window-oriented debugger to
  11777.  debug packed files. The /EXEPACK option strips symbolic information from the
  11778.  input file and notifies you of this with a warning message.
  11779.  
  11780.  The /E option does not always give a significant saving in disk space and
  11781.  may sometimes actually increase file size. Programs that have a large number
  11782.  of load-time relocations (about 500 or more) and long streams of repeated
  11783.  characters are usually shorter if packed. LINK notifies you if the packed
  11784.  file is larger than the unpacked file.
  11785.  
  11786.  
  11787.  13.3.9  Optimizing Far Calls (/F)
  11788.  
  11789.  Option
  11790.  
  11791.       /F«ARCALLTRANSLATION»
  11792.  
  11793.  Using the /F option may result in slightly faster code and smaller
  11794.  executable-file size. It should be used with the /PACKD option, described in
  11795.  Section 13.3.25, in order to achieve significant results. The gain in speed
  11796.  is most apparent for 286- and 386-based machines. Though some assembly
  11797.  programs should not be linked with this option, it is generally safe for use
  11798.  with high-level-language programs. This option is off by default;
  11799.  furthermore, it can always be turned off with the /NOF option described in
  11800.  Section 13.3.18.
  11801.  
  11802.  The rest of this section describes the low-level details of /F. It is not
  11803.  necessary that you understand these details in order to use the option.
  11804.  
  11805.  The /F option directs the linker to optimize far calls to procedures that
  11806.  lie in the same segment as the caller. For example, a medium- or large-model
  11807.  program may have a machine instruction that makes a far call to a procedure
  11808.  in the same segment. Since the segment address is the same (for both the
  11809.  instruction and the procedure it calls), only a near call should be
  11810.  necessary.
  11811.  
  11812.  A near-call instruction does not require an entry in the relocation table,
  11813.  whereas a far-call instruction does. Therefore, use of /F (together with
  11814.  /PACKD) often results in smaller executable files because the relocation
  11815.  table is smaller. Such files will load faster.
  11816.  
  11817.  When /F has been specified, the linker will optimize code by removing the
  11818.  instruction call FAR label and substituting the following sequence:
  11819.  
  11820.            push    cs
  11821.            call    NEAR label
  11822.            nop
  11823.  
  11824.  Upon execution, the called procedure will still return with a far-return
  11825.  instruction. However, because both the code segment and the near address are
  11826.  on the stack, the far return will be executed correctly. The nop (no-op)
  11827.  instruction appears so that exactly five bytes replace the five-byte
  11828.  far-call instruction; the linker may in some cases place the nop at the
  11829.  beginning of the sequence.
  11830.  
  11831.  The /F option has no effect on programs that only make near calls. Of the
  11832.  high-level Microsoft languages, only small- and compact-model C programs use
  11833.  near calls.
  11834.  
  11835.  ───────────────────────────────────────────────────────────────────────────
  11836.  NOTE
  11837.     There is a small risk involved with the /F option: the linker may
  11838.     mistakenly translate a byte in a code segment that happens to have the
  11839.     far-call opcode (9A hexadecimal). If a program linked with /F
  11840.     inexplicably fails, you may want to try linking with this option off.
  11841.     However, object modules produced by Microsoft high-level languages should
  11842.     be safe from this problem because little immediate data is stored in code
  11843.     segments.
  11844.  
  11845.     In general, assembly-language programs are safe for use with the /F
  11846.     option if they do not involve advanced system-level code, such as might
  11847.     be found in operating systems or interrupt handlers.
  11848.  ───────────────────────────────────────────────────────────────────────────
  11849.  
  11850.  
  11851.  13.3.10  Viewing the Options List (/HE)
  11852.  
  11853.  Option
  11854.  
  11855.       /HE«LP»
  11856.  
  11857.  The /HELP option causes LINK to display a list of the available options on
  11858.  the screen. This gives you a convenient reminder of the available options.
  11859.  Do not give a file name when using the /HELP option.
  11860.  
  11861.  
  11862.  13.3.11  Controlling Executable-File Loading (/HI)
  11863.  
  11864.  Option
  11865.  
  11866.       /HI«GH»
  11867.  
  11868.  At load time, the executable file can be placed either as low or as high in
  11869.  memory as possible. Use of the /HI option causes DOS to place the executable
  11870.  file as high as possible in memory. Without the /HI option, DOS places the
  11871.  executable file as low as possible. This option is valid only when linking
  11872.  real-mode programs.
  11873.  
  11874.  ───────────────────────────────────────────────────────────────────────────
  11875.  NOTE
  11876.     This option should be used only with assembly-language programs.
  11877.  ───────────────────────────────────────────────────────────────────────────
  11878.  
  11879.  
  11880.  13.3.12  Preparing for Incremental Linking (/INC)
  11881.  
  11882.  Option
  11883.  
  11884.       /INC«REMENTAL»
  11885.  
  11886.  The /INC option must be used in order to prepare for subsequent linking with
  11887.  ILINK. The use of this option produces a .SYM file and an .ILK file, each
  11888.  containing extra information needed by ILINK. Note that this option is not
  11889.  compatible with the /EXEPACK option. (See Chapter 14, "Incremental Linking
  11890.  with ILINK," for more information on this option.)
  11891.  
  11892.  
  11893.  13.3.13  Displaying Linker Process Information (/INF)
  11894.  
  11895.  Option
  11896.  
  11897.       /INF«ORMATION»
  11898.  
  11899.  The /INF option tells the linker to display information about the linking
  11900.  process, including the phase of linking and the names of the object files
  11901.  being linked. This option is useful if you want to determine the locations
  11902.  of the object files being linked and the order in which they are linked.
  11903.  
  11904.  Output from this option is sent to standard output.
  11905.  
  11906.  The following is a sample of the linker output when the /INF and /MAP
  11907.  options are specified on the LINK command line:
  11908.  
  11909.       **** PASS ONE ****
  11910.       TEST.OBJ(test.for)
  11911.       **** LIBRARY SEARCH ****
  11912.       LLIBFOR7.LIB(wr)
  11913.       LLIBFOR7.LIB(fmtout)
  11914.       LLIBFOR7.LIB(ldout)
  11915.          .
  11916.          .
  11917.          .
  11918.       **** ASSIGN ADDRESSES ****
  11919.         1 segment "TEST_TEXT" length 122H bytes
  11920.         2 segment "_DATA" length 912H bytes
  11921.         3 segment "CONST" length 12H bytes
  11922.          .
  11923.          .
  11924.          .
  11925.       **** PASS TWO ****
  11926.       TEST.OBJ(test.for)
  11927.       LLIBFOR7.LIB(wr)
  11928.       LLIBFOR7.LIB(fmtout)
  11929.       LLIBFOR7.LIB(ldout)
  11930.          .
  11931.          .
  11932.          .
  11933.       **** WRITING EXECUTABLE ****
  11934.  
  11935.  
  11936.  13.3.14  Including Line Numbers in the Map File (/LI)
  11937.  
  11938.  Option
  11939.  
  11940.       /LI«NENUMBERS»
  11941.  
  11942.  You can include the line numbers and associated addresses of your source
  11943.  program in the map file by using the /LI option. Ordinarily the map file
  11944.  does not contain line numbers. To produce a map file with line numbers, you
  11945.  must give LINK an object file (or files) with line-number information. You
  11946.  can use the /Zd option with any Microsoft compiler to include line numbers
  11947.  in the object file. If you give LINK an object file without line-number
  11948.  information, the /LI option has no effect.
  11949.  
  11950.  The /LI option forces LINK to create a map file even if you did not
  11951.  explicitly tell the linker to create a map file. By default, the file is
  11952.  given the same base name as the executable file, plus the extension .MAP.
  11953.  You can override the default name by specifying a new map file on the LINK
  11954.  command line or in response to the List File prompt.
  11955.  
  11956.  
  11957.  13.3.15  Listing Public Symbols (/M)
  11958.  
  11959.  Option
  11960.  
  11961.       /M«AP»
  11962.  
  11963.  You can list all public (global) symbols defined in the object file(s) by
  11964.  using the /M option. When you invoke LINK with the /M option, the map file
  11965.  will contain a list of all the symbols sorted by name and a list of all the
  11966.  symbols sorted by address. If you do not use this option, the map file
  11967.  contains only a list of segments.
  11968.  
  11969.  When you use this option, the default for the mapfile field or prompts
  11970.  response is no longer NUL. Instead, the default is a name that combines the
  11971.  base name of the executable file with a .MAP extension. It is still possible
  11972.  for you to specify NUL in the mapfile field (which indicates that no map
  11973.  file is to be generated); if you do, then the /M option will have no effect.
  11974.  
  11975.  
  11976.  13.3.16  Ignoring Default Libraries (/NOD)
  11977.  
  11978.  Option
  11979.  
  11980.       /NOD«EFAULTLIBRARYSEARCH»«:filename»
  11981.  
  11982.  The /NOD option tells LINK not to search any library specified in the object
  11983.  file to resolve external references. If you specify filename, LINK searches
  11984.  all libraries specified in the object file except for filename.
  11985.  
  11986.  In general, higher-level-language programs do not work correctly without a
  11987.  standard library. Thus, if you use the /NOD option, you should explicitly
  11988.  specify the name of a standard library.
  11989.  
  11990.  
  11991.  13.3.17  Ignoring Extended Dictionary (/NOE)
  11992.  
  11993.  Option
  11994.  
  11995.       /NOE«XTDICTIONARY»
  11996.  
  11997.  The /NOE option prevents the linker from searching the extended dictionary,
  11998.  which is an internal list of symbol locations that the linker maintains.
  11999.  Normally, the linker consults this list to speed up library searches.The
  12000.  effect of the /NOE option is to slow the linker. You often need to use this
  12001.  option when a library symbol is redefined. The linker issues error L2044 if
  12002.  you need to use this option.
  12003.  
  12004.  
  12005.  13.3.18  Disabling Far-Call Optimization (/NOF)
  12006.  
  12007.  Option
  12008.  
  12009.       /NOF«ARCALLTRANSLATION»
  12010.  
  12011.  This option normally is not necessary because far-call optimization
  12012.  (translation) is turned off by default. However, if an environment variable
  12013.  such as LINK (or CL) turns on far-call translation automatically, you can
  12014.  use /NOF to turn far-call translation back off again.
  12015.  
  12016.  
  12017.  13.3.19  Preserving Compatibility (/NOG)
  12018.  
  12019.  Option
  12020.  
  12021.       /NOG«ROUPASSOCIATION»
  12022.  
  12023.  The /NOG option causes the linker to ignore group associations when
  12024.  assigning addresses to data and code items. It is provided primarily for
  12025.  compatibility with previous versions of the linker (Versions 2.02 and
  12026.  earlier) and early versions of Microsoft language compilers. This option is
  12027.  valid only when linking real-mode programs.
  12028.  
  12029.  ───────────────────────────────────────────────────────────────────────────
  12030.  NOTE
  12031.     This option should be used only with assembly-language programs.
  12032.  ───────────────────────────────────────────────────────────────────────────
  12033.  
  12034.  
  12035.  13.3.20  Preserving Case Sensitivity (/NOI)
  12036.  
  12037.  Option
  12038.  
  12039.       /NOI«GNORECASE»
  12040.  
  12041.  By default, LINK treats uppercase letters and lowercase letters as
  12042.  equivalent. Thus ABC, abc, and Abc are considered the same name. When you
  12043.  use the /NOI option, the linker distinguishes between uppercase letters and
  12044.  lowercase letters, and considers ABC, abc, and Abc to be three separate
  12045.  names. Since names in some high-level languages are not case sensitive, this
  12046.  option can have minimal importance. However, in some languages──such as
  12047.  C──case is significant. If you plan to link your files from other high-level
  12048.  languages with C routines, you may want to use this option.
  12049.  
  12050.  
  12051.  13.3.21  Ordering Segments without Inserting NULL Bytes (/NON)
  12052.  
  12053.  Options
  12054.  
  12055.       /NON«ULLSDOSSEG»
  12056.  
  12057.  The /NON option directs the linker to arrange segments in the same order as
  12058.  they are arranged by the /DOSSEG option. The only difference is that the
  12059.  /DOSSEG option inserts 16 null bytes at the beginning of the _TEXT segment
  12060.  (if it is defined), whereas /NON does not insert these extra bytes.
  12061.  
  12062.  If the linker is given both the /DOSSEG and /NON options, the /NON option
  12063.  will always take precedence. Therefore, you can use /NON to override the
  12064.  /DOSSEG comment record commonly found in run-time libraries. This option is
  12065.  for linking protected-mode programs or Windows applications.
  12066.  
  12067.  
  12068.  13.3.22  Disabling Segment Packing (/NOP)
  12069.  
  12070.  Option
  12071.  
  12072.       /NOP«ACKCODE»
  12073.  
  12074.  This option is normally not necessary because code-segment packing is turned
  12075.  off by default. However, if an environment variable such as LINK (or CL)
  12076.  turns on code-segment packing automatically, you can use /NOP to turn
  12077.  segment packing back off again.
  12078.  
  12079.  
  12080.  13.3.23  Setting the Overlay Interrupt (/O)
  12081.  
  12082.  Option
  12083.  
  12084.        /O«VERLAYINTERRUPT»:number
  12085.  
  12086.  By default, the interrupt number used for passing control to overlays is 63
  12087.  (3F hexadecimal). The /O option allows the user to select a different
  12088.  interrupt number. This option is valid only when linking real-mode programs.
  12089.  
  12090.  The number can be a decimal number from 0 to 255, an octal number from octal
  12091.  0 to octal 0377, or a hexadecimal number from hexadecimal 0 to hexadecimal
  12092.  FF. Numbers that conflict with DOS interrupts can be used; however, their
  12093.  use is not advised.
  12094.  
  12095.  You should use this option only when you want to uses overlays with a
  12096.  program that already reserves interrupt 63 for some other purpose.
  12097.  
  12098.  
  12099.  13.3.24  Packing Contiguous Data Segments (/PACKC)
  12100.  
  12101.  Option
  12102.  
  12103.       /PACKC«ODE»«:number»
  12104.  
  12105.  This option only affects code segments in medium- and large-model programs.
  12106.  It is intended to be used with the /F option, which is described in Section
  12107.  13.3.9. It is not necessary to understand the details of the /PACKC option
  12108.  in order to use it. You only need to know that this option, used in
  12109.  conjunction with /F, produces slightly faster and more compact code. The
  12110.  /PACKC option is off by default, and can always be turned off with the /NOP
  12111.  option described in Section 13.3.22.
  12112.  
  12113.  The /PACKC option directs the linker to group together neighboring code
  12114.  segments. Segments in the same group are assigned the same segment address;
  12115.  offset addresses are adjusted upward accordingly. In other words, all items
  12116.  will have the correct physical address whether the /PACKC option is used or
  12117.  not. However, /PACKC changes segment and offset addresses so that all items
  12118.  in a group share the same segment address.
  12119.  
  12120.  The number field specifies the maximum size of groups formed by /PACKC. The
  12121.  linker will stop adding segments to a group as soon as it cannot add another
  12122.  segment without exceeding number. At that point, the linker starts forming a
  12123.  new group. The default for number is 65,530.
  12124.  
  12125.  The packaging of code segments provides more opportunities for far-call
  12126.  optimization, which is enabled with /F. Generally speaking, /F and /PACKC
  12127.  are designed to be used together.
  12128.  
  12129.  Programs developed with Microsoft high-level languages can safely use
  12130.  /PACKC. The /PACKC option is unsafe only when used with assembly programs
  12131.  that make assumptions about the relative order of code segments. For
  12132.  example, the following assembly code attempts to calculate the distance
  12133.  between CSEG1 and CSEG2. This code would produce incorrect results when used
  12134.  with /PACKC, because /PACKC causes the two segments to share segment
  12135.  address. Therefore the procedure would always return zero.
  12136.  
  12137.       CSEG1      SEGMENT PUBLIC 'CODE'
  12138.       .
  12139.       .
  12140.       .
  12141.       CSEG1      ENDS
  12142.  
  12143.       CSEG2      SEGMENT PARA PUBLIC 'CODE'
  12144.                  ASSUME  cs:CSEG2
  12145.  
  12146.       ; Return the length of CSEG1 in AX.;
  12147.  
  12148.       codesize   PROC  NEAR
  12149.                  mov   ax,CSEG2   ; Load para address of CSEG1;
  12150.                  sub   ax,CSEG1   ; Load para address of CSEG2;
  12151.                  mov   cx,4       ; Load count, and
  12152.                  shl   ax,c l     ; convert distance from paragraphs
  12153.                                   ; to bytes;
  12154.       codesize  ENDP
  12155.  
  12156.       CSEG2      ENDS
  12157.  
  12158.  
  12159.  13.3.25  Packing Contiguous Data Segments (/PACKD)
  12160.  
  12161.  Option
  12162.  
  12163.       /PACKD«ATA»«:number»
  12164.  
  12165.  This option only affects code segments in medium- and large-model programs.
  12166.  This option is also safe with all Microsoft high-level language compilers.
  12167.  It behaves exactly like /PACKCODE except it applies to data segments, not
  12168.  code segments. The linker recognizes data segments as any segment definition
  12169.  with a class name which does not end in CODE. The adjacent data segment
  12170.  definitions are combined into the same physical segment up to the given
  12171.  limit. The default limit is 65,536.
  12172.  
  12173.  With large and compact-model programs containing many modules, it may be
  12174.  necessary to use this option to get around the limit of 255 physical data
  12175.  segments per executable file imposed by OS/2 and Windows. If you get error
  12176.  L1073 from the liner, try using this option.
  12177.  
  12178.  The number field specifies the maximum size of groups formed by /PACKD. The
  12179.  linker will stop adding segments to a group as soon as it cannot add another
  12180.  segment without exceeding number. At that point, the linker starts forming a
  12181.  new group. The default for number is 65,530.
  12182.  
  12183.  This option may not be safe with other compilers that do not generate fixup
  12184.  records for all far data references. This option is valid for OS/2 and
  12185.  Windows programs only.
  12186.  
  12187.  
  12188.  13.3.26  Padding Code Segments (/PADC)
  12189.  
  12190.  Option
  12191.  
  12192.       /PADC«ODE»:padsize
  12193.  
  12194.  The /PADC option causes LINK to add filler bytes to the end of each code
  12195.  module for subsequent linking with ILINK. The option is followed by a colon
  12196.  and the number of bytes to add. (A decimal radix is assumed, but you can
  12197.  specify octal or hexadecimal numbers by using a C-language prefix.) Thus
  12198.  
  12199.       /PADCODE:256
  12200.  
  12201.  adds an additional 256 bytes to each module. The default size for
  12202.  code-module padding is 0 bytes. If you are going to use this option, you
  12203.  must also specify the /INC option.
  12204.  
  12205.  ───────────────────────────────────────────────────────────────────────────
  12206.  NOTE
  12207.     Code padding is usually not necessary for large-and medium-memory-model
  12208.     programs, but is recommended for small-compact and mixed-memory-model
  12209.     programs, and for Microsoft Macro Assembler (MASM) programs in which
  12210.     code segments are grouped.
  12211.  ───────────────────────────────────────────────────────────────────────────
  12212.  
  12213.  To be recognized as a code segment, a segment must be declared with class
  12214.  name 'CODE'. The class name need only end with 'CODE' (Microsoft high-level
  12215.  languages automatically use this declaration for code segments.)
  12216.  
  12217.  
  12218.  13.3.27  Padding Data Segments (/PADD)
  12219.  
  12220.  Syntax
  12221.  
  12222.       /PADD«ATA»:padsize
  12223.  
  12224.  The /PADD option performs a function similar to the /PADCODE option, except
  12225.  it specifies padding for data segments (or data modules, if the program uses
  12226.  small- or medium-memory model). This option is supplied for subsequent
  12227.  linking with ILINK. Thus
  12228.  
  12229.       /PADDATA:32
  12230.  
  12231.  adds an additional 32 bytes to each data module. The default size for
  12232.  data-segment padding is 16 bytes. If you are going to use the /PADD option,
  12233.  you must also specify the /INC option.
  12234.  
  12235.  ───────────────────────────────────────────────────────────────────────────
  12236.  NOTE
  12237.     If you specify too large a value for padsize, you may exceed the 64K
  12238.     limitation on the size of the default data segment.
  12239.  ───────────────────────────────────────────────────────────────────────────
  12240.  
  12241.  
  12242.  13.3.28  Pausing during Linking (/PAU)
  12243.  
  12244.  Option
  12245.  
  12246.       /PAU«SE»
  12247.  
  12248.  Unless you instruct it otherwise, LINK performs the linking session from
  12249.  beginning to end without stopping. The /PAU option tells LINK to pause in
  12250.  the session before it writes the executable (.EXE) file to disk. This option
  12251.  allows you to swap disks before LINK writes the executable file.
  12252.  
  12253.  If you specify the /PAU option, LINK displays the following message before
  12254.  it creates the run file:
  12255.  
  12256.       About to generate .EXE file
  12257.       Change diskette in drive letter and press <ENTER>
  12258.  
  12259.  The letter corresponds to the current drive. LINK resumes processing when
  12260.  you press ENTER .
  12261.  
  12262.  ───────────────────────────────────────────────────────────────────────────
  12263.  NOTE
  12264.     Do not remove the disk that will receive the list file or the disk used
  12265.     for the temporary file.
  12266.  
  12267.     If a temporary file is created on the disk you plan to swap, press CTRL+C
  12268.     to terminate the LINK session. Rearrange your files so that the temporary
  12269.     file and the executable file can be written to the same disk. Then try
  12270.     linking again.
  12271.  
  12272.     For more information on how LINK determines where to put the temporary
  12273.     file, see Section 13.2.6, "LINK Memory Requirements."
  12274.  ───────────────────────────────────────────────────────────────────────────
  12275.  
  12276.  
  12277.  13.3.29  Specifying User Libraries for Quick Languages (/Q)
  12278.  
  12279.  Option
  12280.  
  12281.       /Q«UICKLIB»
  12282.  
  12283.  The /Q option directs the linker to produce a "Quick library,"suitable for
  12284.  use with Microsoft QuickBASIC or Microsoft QuickC(R) programs, instead of
  12285.  producing a stand-alone application. (Stand-alone applications are
  12286.  executable files that need only the presence of DOS to run. The linker
  12287.  produces these by default.)
  12288.  
  12289.  No other option is necessary to enable Quick-library creation. When you use
  12290.  /Q, the exefile field refers to a Quick library instead of to an
  12291.  application. The default extension for this field is then .QLB instead of
  12292.  .EXE. You can use all of the linker features to build a Quick library that
  12293.  you would otherwise use to build an application. The principal difference is
  12294.  that a Quick library does not require (and should not contain) any
  12295.  main-program-level code.
  12296.  
  12297.  A Quick library is similar to a standard software library in that both
  12298.  contain a collection of routines that may be called upon by a program. The
  12299.  two libraries are different, however: a standard library is brought together
  12300.  with a program at link time; a Quick library, by contrast, is brought
  12301.  together with a program at run time.
  12302.  
  12303.  ───────────────────────────────────────────────────────────────────────────
  12304.  NOTE
  12305.     Two special restrictions apply to use of a Quick library:
  12306.  
  12307.     1. Quick libraries can be loaded only by programs created with QuickC or
  12308.     QuickBASIC. These programs have the special code that properly loads a
  12309.     Quick library at run time.
  12310.  
  12311.     2. Routines in a Quick library can be called from any module at run time.
  12312.     However, Quick-library routines cannot themselves make calls to routines
  12313.     outside the library. In other words, Quick libraries must be
  12314.     self-contained.
  12315.  ───────────────────────────────────────────────────────────────────────────
  12316.  
  12317.  The linker creates a Quick library not by linking it to a program, but
  12318.  instead by placing into a file all of the object modules to be included and
  12319.  by adding a location table of all of the library routines. This table allows
  12320.  references to be resolved at run time, after the entire library is loaded
  12321.  into memory. For further information on the use of these libraries, consult
  12322.  the user's guide for QuickBASIC or QuickC.
  12323.  
  12324.  
  12325.  13.3.30  Setting Maximum Number of Segments (/SE)
  12326.  
  12327.  Option
  12328.  
  12329.       /SE«GMENTS»:number
  12330.  
  12331.  The /SE option controls the number of segments the linker allows a program
  12332.  to have. The default is 128, but you can set number to any value (decimal,
  12333.  octal, or hexadecimal) in the range 1 to 3,072 (decimal). However, the
  12334.  number of segment definitions is constrained by memory usage. Therefore, the
  12335.  practical limit to the number is around 1,500.
  12336.  
  12337.  For each segment, the linker must allocate some space to keep track of
  12338.  segment information. By using a relatively low segment limit as a default
  12339.  (128), the linker is able to link faster and allocate less storage space.
  12340.  
  12341.  When you set the segment limit higher than 128, the linker allocates more
  12342.  space for segment information. This option allows you to raise the segment
  12343.  limit for programs with a large number of segments. For programs with fewer
  12344.  than 128 segments, you can keep the storage requirements of the linker at
  12345.  the lowest level possible by setting the segment number field to reflect the
  12346.  actual number of segments in the program. If the number of segments
  12347.  allocated is too high for the amount of memory LINK has available to it, you
  12348.  will see the following error message:
  12349.  
  12350.       segment limit too high
  12351.  
  12352.  To specify a number of segments that will fit in the amount of memory
  12353.  available, set the segment lower and relink the object files.
  12354.  
  12355.  
  12356.  13.3.31  Controlling Stack Size (/ST)
  12357.  
  12358.  Option
  12359.  
  12360.       /ST«ACK»:number
  12361.  
  12362.  The /ST option allows you to specify the size of the stack for your program.
  12363.  The number is any positive value (decimal, octal,or hexadecimal) up to
  12364.  65,535 (decimal). It represents the size, in bytes, of the stack.
  12365.  
  12366.  If you get a stack-overflow message, you may need to increase the size of
  12367.  the stack. In contrast, if your program uses the stack very little, you may
  12368.  save some space by decreasing the stack size.
  12369.  
  12370.  ───────────────────────────────────────────────────────────────────────────
  12371.  NOTE
  12372.     You can also use the EXEMOD utility, described in Section 17.1, to
  12373.     change the default stack size in DOS executable files by modifying the
  12374.     executable-file header. The format of the executable-file header is
  12375.     discussed in that section as well as in the Microsoft MS-DOS programmer's
  12376.     Reference and in other reference books on DOS.
  12377.  ───────────────────────────────────────────────────────────────────────────
  12378.  
  12379.  
  12380.  13.3.32  Issuing Fixup Warnings (/W)
  12381.  
  12382.  Option
  12383.  
  12384.       /W«ARNFIXUP»
  12385.  
  12386.  The /WARNFIXUP option directs the linker to issue a warning for each segment
  12387.  relative fixup of location-type "offset," such that the segment is contained
  12388.  within a group but is not at the beginning of the group. The linker will
  12389.  include the displacement of the segment from the group in determining the
  12390.  final value of the fixup, contrary to what happens with DOS executable
  12391.  files. This option is for linking protected-mode programs or Windows
  12392.  applications.
  12393.  
  12394.  
  12395.  13.4  Selecting Options with the LINK Environment Variable
  12396.  
  12397.  You can use the LINK environment variable to cause certain options to be
  12398.  used each time you link. The linker checks the environment variable for
  12399.  options, if the variable exists.
  12400.  
  12401.  The linker expects to find options listed in the variable exactly as you
  12402.  would type them on the command line. It will not accept other kinds of
  12403.  arguments; file names in the environment variable will cause the following
  12404.  error message:
  12405.  
  12406.       unrecognized option
  12407.  
  12408.  Each time you link, you can specify other options in addition to the ones
  12409.  specified in the LINK environment variable. If you type an option both on
  12410.  the command line and in the environment variable, the effect will be the
  12411.  same as if the option were given once.
  12412.  
  12413.  Example
  12414.  
  12415.       >SET LINK=/NOI /SE:256 /CO
  12416.       >LINK TEST;
  12417.       >LINK /NOD /CO PROG;
  12418.  
  12419.  In the example above, the file TEST.OBJ is linked with the options /NOI,
  12420.  /SE:256, and /CO. The file PROG.OBJ is then linked with the option /NOD,
  12421.  in addition to /NOI, /SE:256, and /CO.
  12422.  
  12423.  ───────────────────────────────────────────────────────────────────────────
  12424.  NOTE
  12425.     A command-line option will override the effect of any
  12426.     environment-variable option that it conflicts with. For example, the
  12427.     command-line option/SE:512 cancels the effect of the environment-variable
  12428.     option /SE:256.
  12429.  
  12430.     The only way to prevent an option in the environment variable from being
  12431.     used is to reset the environment variable itself.
  12432.  ───────────────────────────────────────────────────────────────────────────
  12433.  
  12434.  
  12435.  13.5  Linker Operation
  12436.  
  12437.  LINK performs the following steps to combine object modules and produce an
  12438.  executable file:
  12439.  
  12440.    1. Reads the object modules submitted
  12441.  
  12442.    2. Searches the given libraries, if necessary, to resolve external
  12443.       references
  12444.  
  12445.    3. Assigns addresses to segments
  12446.  
  12447.    4. Assigns addresses to public symbols
  12448.  
  12449.    5. Reads code and data in the segments
  12450.  
  12451.    6. Reads all relocation references in object modules
  12452.  
  12453.    7. Performs fixups
  12454.  
  12455.    8. Outputs an executable file (executable image and relocation
  12456.       information)
  12457.  
  12458.  Steps 5, 6, and 7 are performed concurrently──in other words, LINK moves
  12459.  back and forth between these steps before it progresses to step 8.
  12460.  
  12461.  The "executable image" contains the code and data that constitute the
  12462.  executable file. The "relocation information" is a list of references
  12463.  relative to the start of the program, each of which changes when the
  12464.  executable image is loaded into memory and an actual address for the entry
  12465.  point is assigned.
  12466.  
  12467.  The following sections explain the process LINK uses to concatenate segments
  12468.  and resolve references to items in memory.
  12469.  
  12470.  
  12471.  13.5.1  Alignment of Segments
  12472.  
  12473.  LINK uses a segment's alignment type to set the starting address for the
  12474.  segment. The alignment types are BYTE, WORD, PARA, and PAGE. These
  12475.  correspond to starting addresses at byte, word, paragraph, and page
  12476.  boundaries, representing addresses that are multiples of 1, 2, 16, and 256,
  12477.  respectively. The default alignment is PARA.
  12478.  
  12479.  When LINK encounters a segment, it checks the alignment type before copying
  12480.  the segment to the executable file. If the alignment is WORD, PARA, or PAGE,
  12481.  LINK checks the executable image to see if the last byte copied ends at an
  12482.  appropriate boundary. If not, LINK pads the image with extra null bytes.
  12483.  
  12484.  
  12485.  13.5.2  Frame Number
  12486.  
  12487.  LINK computes a starting address for each segment in a program. The starting
  12488.  address is based on a segment's alignment and the sizes of the segments
  12489.  already copied to the executable file (as described in Section 13.5.1,
  12490.  above). The address consists of an offset and a "canonical frame number."
  12491.  The canonical frame number specifies the address of the first paragraph in
  12492.  memory containing one or more bytes of the segment. (A paragraph is 16 bytes
  12493.  of memory; therefore, to compute a physical location in memory, multiply the
  12494.  frame number by 16 and add the offset.) The offset is the number of bytes
  12495.  from the start of the paragraph to the first byte in the segment. For BYTE
  12496.  and WORD alignments, the offset may be nonzero. The offset is always zero
  12497.  for PARA and PAGE alignments. (An offset of zero means that the physical
  12498.  location is an exact multiple of 16.)
  12499.  
  12500.  The frame number of a segment can be obtained from the map file created by
  12501.  LINK. The first four digits of the start address give the frame number in
  12502.  hexadecimal. For example, a start address of 0C0A6 gives a frame number of
  12503.  0C0A.
  12504.  
  12505.  
  12506.  13.5.3  Order of Segments
  12507.  
  12508.  LINK copies segments to the executable file in the same order that it
  12509.  encounters them in the object files. This order is maintained throughout the
  12510.  program unless LINK encounters two or more segments having the same class
  12511.  name. Segments having identical class names belong to the same class type
  12512.  and are copied as a contiguous block to the executable file.
  12513.  
  12514.  The /DOSSEG option may change the way in which segments are ordered.
  12515.  
  12516.  
  12517.  13.5.4  Combined Segments
  12518.  
  12519.  LINK uses combine types to determine whether or not two or more segments
  12520.  sharing the same segment name should be combined into one large segment. The
  12521.  valid combine types are PUBLIC, STACK, COMMON, and PRIVATE.
  12522.  
  12523.  If a segment has combine type PUBLIC, LINK automatically combines it with
  12524.  any other segments having the same name and belonging to the same class.
  12525.  When LINK combines segments, it ensures that the segments are contiguous and
  12526.  that all addresses in the segments can be accessed using an offset from the
  12527.  same frame address. The result is the same as if the segment were defined as
  12528.  a whole in the source file.
  12529.  
  12530.  LINK preserves each individual segment's alignment type. This means that
  12531.  even though the segments belong to a single, large segment, the code and
  12532.  data in the segments do not lose their original alignment. If the combined
  12533.  segments exceed 64K, LINK displays an error message.
  12534.  
  12535.  If a segment has combine type STACK, then LINK carries out the same combine
  12536.  operation as for PUBLIC segments. The only exception is STACK segments cause
  12537.  LINK to copy an initial stack-pointer value to the executable file. This
  12538.  stack-pointer value is the offset to the end of the first stack segment (or
  12539.  combined stack segment) encountered.
  12540.  
  12541.  If a segment has combine type COMMON, then LINK automatically combines it
  12542.  with any other segments having the same name and belonging to the same
  12543.  class. When LINK combines COMMON segments, however, it places the start of
  12544.  each segment at the same address, creating a series of overlapping segments.
  12545.  The result is a single segment no larger than the largest segment combined.
  12546.  
  12547.  A segment has combine type PRIVATE only if no explicit combine type is
  12548.  defined for it in the source file. LINK does not combine private segments.
  12549.  
  12550.  
  12551.  13.5.5  Groups
  12552.  
  12553.  Groups allow segments to be addressed relative to the same frame address.
  12554.  When LINK encounters a group, it adjusts all memory references to items in
  12555.  the group so that they are relative to the same frame address.
  12556.  
  12557.  Segments in a group do not have to be contiguous, belong to the same class,
  12558.  or have the same combine type. The only requirement is all segments in the
  12559.  group fit within 64K.
  12560.  
  12561.  Groups do not affect the order in which the segments are loaded. Unless you
  12562.  use class names and enter object files in the right order, there is no
  12563.  guarantee that the segments will be contiguous. In fact, LINK may place
  12564.  segments that do not belong to the group in the same 64K of memory. LINK
  12565.  does not explicitly check that all segments in a group fit within 64K of
  12566.  memory; however, LINK is likely to encounter a fixup-overflow error if this
  12567.  requirement is not met.
  12568.  
  12569.  
  12570.  13.5.6  Fixups
  12571.  
  12572.  Once the starting address of each segment in a program is known and all
  12573.  segment combinations and groups have been established, LINK can "fix up" any
  12574.  unresolved references to labels and variables. To fix up unresolved
  12575.  references, LINK computes an appropriate offset and segment address and
  12576.  replaces the temporary values generated by the assembler with the new
  12577.  values.
  12578.  
  12579.  LINK carries out fixups for the types of references shown in the following
  12580.  list:
  12581.  
  12582. ╓┌───────────────────────────┌───────────────────────────────────────────────╖
  12583.  Type of Reference           Description
  12584.  
  12585.  Short                       Occurs in JMP instructions that attempt to pass
  12586.                              control to labeled instructions in the same
  12587.                              segment or group.
  12588.  
  12589.                              The target instruction must be no more than 128
  12590.                              bytes from the point of reference. LINK computes
  12591.                              a signed, 8-bit number for this reference. It
  12592.                              displays an error message if the target
  12593.                              instruction belongs to a different segment or
  12594.                              group (has a different frame address), or if the
  12595.                              target is more than 128 bytes distant in either
  12596.                              direction.
  12597.  
  12598.  Near self relative          Occurs in instructions that access data relative
  12599.                              to the same segment or group.
  12600.  
  12601.                              LINK computes a 16-bit offset for this
  12602.  Type of Reference           Description
  12603.  
  12604.                             LINK computes a 16-bit offset for this
  12605.                              reference. It displays an error if the data are
  12606.                              not in the same segment or group.
  12607.  
  12608.  Near segment relative       Occurs in instructions that attempt to access
  12609.                              data in a specified segment or group, or
  12610.                              relative to a specified segment register.
  12611.  
  12612.                              LINK computes a 16-bit offset for this
  12613.                              reference. It displays an error message if the
  12614.                              offset of the target within the specified frame
  12615.                              is greater than 64K or less than 0, or if the
  12616.                              beginning of the canonical frame of the target
  12617.                              is not addressable.
  12618.  
  12619.  Long                        Occurs in CALL instructions that attempt to
  12620.                              access an instruction in another segment or
  12621.                              group.
  12622.  
  12623.  Type of Reference           Description
  12624.  
  12625. 
  12626.                              LINK computes a 16-bit frame address and 16-bit
  12627.                              offset for this reference. LINK displays an
  12628.                              error message if the computed offset is greater
  12629.                              than 64K or less than 0, or if the beginning of
  12630.                              the canonical frame of the target is not
  12631.                              addressable.
  12632.  
  12633.  
  12634.  The size of the value to be computed depends on the type of reference. If
  12635.  LINK discovers an error in the anticipated size of a reference, it displays
  12636.  a fixup-overflow message. This can happen, for example, if a program
  12637.  attempts to use a 16-bit offset to reach an instruction which is more than
  12638.  64K away. It can also occur if all segments in a group do not fit within a
  12639.  single 64K block of memory.
  12640.  
  12641.  
  12642.  13.6  Using Overlays
  12643.  
  12644.  You can direct LINK to create an overlaid version of a program. In an
  12645.  overlaid version of a program, specified parts of the program (known as
  12646.  "overlays") are loaded only if and when they are needed. These parts share
  12647.  the same space in memory. Only code is overlaid; data are never overlaid.
  12648.  Programs that use overlays usually require less memory, but they run more
  12649.  slowly because of the time needed to read and reread the code from disk into
  12650.  memory.
  12651.  
  12652.  When you use overlays, the linker loads in code for the overlay manager.
  12653.  This code resides in each of the Microsoft high-level language libraries (so
  12654.  you must link with at least one such library), and is between 2K and 3K in
  12655.  size.
  12656.  
  12657.  You specify overlays by enclosing them in parentheses in the list of object
  12658.  files that you submit to the linker. Each module in parentheses represents
  12659.  one overlay. For example, you could give the following object-file list in
  12660.  the objfiles field of the LINK command line:
  12661.  
  12662.       a + (b+c) + (e+f) + g + (i)
  12663.  
  12664.  In this example, the modules (b+c), (e+f), and (i) are overlays. The remainin
  12665.  modules, and any drawn from the run-time libraries, constitute the resident
  12666.  part (or root) of your program. Overlays are loaded into the same region of
  12667.  memory, so only one can be resident at a time. Duplicate names in different
  12668.  overlays are not supported, so each module can appear only once in a
  12669.  program.
  12670.  
  12671.  The linker replaces calls from the root to an overlay and calls from an
  12672.  overlay to another overlay with an interrupt (followed by the module
  12673.  identifier and offset). By default, the interrupt number is 63 (3F
  12674.  hexadecimal). You can use the /OVERLAYINTERRUPT option of the LINK command
  12675.  to change the interrupt number.
  12676.  
  12677.  The CodeView debugger is now compatible with overlaid modules. In fact, in
  12678.  the case of large programs, you may need to use overlays
  12679.  
  12680.  
  12681.  13.6.1  Restrictions on Overlays
  12682.  
  12683.  You can overlay only modules to which control is transferred and returned by
  12684.  a standard 8086 long (32-bit) call/return instruction. Therefore, because
  12685.  calls to subroutines modified with the NEAR attribute are short (16-bit)
  12686.  calls, you cannot overlay modules containing NEAR subroutines if other
  12687.  modules call those subroutines. You cannot use long jumps with the longjmp
  12688.  library function. Also, the linker does not produce overlay modules that can
  12689.  be called indirectly through function pointers.
  12690.  
  12691.  
  12692.  13.6.2  Overlay-Manager Prompts
  12693.  
  12694.  The overlay manager is part of the language's run-time library. If you
  12695.  specify overlays during linking, the code for the overlay manager is
  12696.  automatically linked with the other modules of your program.
  12697.  
  12698.  When the executable file is run, the overlay manager searches for that file
  12699.  whenever another overlay needs to be loaded. The overlay manager first
  12700.  searches for the file in the current directory; then, if it does not find
  12701.  the file, the manager searches the directories listed in the PATH
  12702.  environment variable. When it finds the file, the overlay manager extracts
  12703.  the overlay modules specified by the root program. If the overlay manager
  12704.  cannot find an overlay file when needed, it prompts the user to enter the
  12705.  file name.
  12706.  
  12707.  Even with overlays, the linker produces only one .EXE file. This file is
  12708.  opened again and again as long as the overlay manager needs to extract new
  12709.  overlay modules.
  12710.  
  12711.  For example, assume that an executable program called PAYROLL.EXE uses
  12712.  overlays and does not exist in either the current directory or the
  12713.  directories specified by PATH. If the user runs PAYROLL.EXE (by entering a
  12714.  complete path specification), the overlay manager displays the following
  12715.  message when it attempts to load overlay files:
  12716.  
  12717.       Cannot find PAYROLL.EXE
  12718.       Please enter new program spec:
  12719.  
  12720.  The user can then enter the drive or directory, or both, where PAYROLL.EXE
  12721.  is located. For example, if the file is located in directory \EMPLOYEE\DATA\
  12722.  on drive B, the user could enter B:\EMPLOYEE\DATA\ or simply enter
  12723.  \EMPLOYEE\DATA\ if the current drive is B.
  12724.  
  12725.  If the user later removes the disk in drive B and the overlay manager needs
  12726.  to access the overlay again, it does not find PAYROLL.EXE and displays the
  12727.  following message:
  12728.  
  12729.       Please insert diskette containing B:\EMPLOYEE\DATA\PAYROLL.EXE
  12730.       in drive B: and strike any key when ready.
  12731.  
  12732.  After the overlay file has been read from the disk, the overlay manager
  12733.  displays the following message:
  12734.  
  12735.       Please restore the original diskette.
  12736.       Strike any key when ready.
  12737.  
  12738.  
  12739.  Chapter 14  Incremental Linking with ILINK
  12740.  ───────────────────────────────────────────────────────────────────────────
  12741.  
  12742.  The Microsoft Incremental Linker (ILINK) is a utility that enables you to
  12743.  link your application much faster. You can benefit from its use when you
  12744.  change a small subset of the modules used to link a program. The program can
  12745.  use any memory model, but in the small model LINK is not efficient unless no
  12746.  symbolic change address is used. Furthermore, to benefit from ILINK, you
  12747.  need to follow certain restrictions that are described in this chapter.
  12748.  Should ILINK fail to link your changes into the executable file, it attempts
  12749.  to invoke the full linker, LINK, or carry out any other commands you specify
  12750.  on the command line. Before you can use ILINK, you must first run the full
  12751.  linker with special options.
  12752.  
  12753.  ───────────────────────────────────────────────────────────────────────────
  12754.  NOTE
  12755.     You can use ILINK to develop dynamic-link libraries as well as
  12756.     applications. Everything said in this chapter about applications and
  12757.     executable files applies to dynamic-link libraries as well. This chapter
  12758.     uses the term "library" to refer specifically to an object-code library
  12759.     (a .LIB file).
  12760.  ───────────────────────────────────────────────────────────────────────────
  12761.  
  12762.  
  12763.  14.1  Definitions
  12764.  
  12765.  Incremental linking involves certain specialized concepts. You may need to
  12766.  review the following list of terms in order to understand the rest of this
  12767.  chapter:
  12768.  
  12769. ╓┌───────────────────────────┌───────────────────────────────────────────────╖
  12770.  Term                                       Meaning
  12771.  
  12772.  Segment                     A contiguous area of memory up to 64K in size.
  12773.                              See the definitions of "physical segment" and
  12774.                              "logical segment" below.
  12775.  
  12776.  Module                      A unit of code or data defined by one source
  12777.                              file. In BASIC, Pascal, and large-memory-model C
  12778.                              and FORTRAN programs, each module corresponds to
  12779.                              a different segment. In small-memory-model
  12780.                              programs, all code modules contribute to one
  12781.                              code segment, and all data modules contribute to
  12782.                              one data segment.
  12783.  
  12784.  Memory model                The memory model determines the number of code
  12785.                              and data segments in a program. BASIC programs
  12786.                              are always large memory model.
  12787.  
  12788.  Physical segment            A segment listed in the executable file's
  12789.                              segment table. Each physical segment has a
  12790.                              distinct segment address, whereas logical
  12791.  Term                                       Meaning
  12792.  
  12793.                             distinct segment address, whereas logical
  12794.                              segments may share a segment address. A physical
  12795.                              segment usually contains one logical segment,
  12796.                              but it can contain more.
  12797.  
  12798.  Logical segment             A segment defined in an object module. Each
  12799.                              physical segment other than DGROUP contains
  12800.                              exactly one logical segment, except when you use
  12801.                              the GROUP directive in a MASM module. (Linking
  12802.                              with the /PACKCODE option can also create more
  12803.                              than one logical segment per physical segment.)
  12804.  
  12805.  Code symbol                 The address of a function, subroutine, or
  12806.                              procedure.
  12807.  
  12808.  Data symbol                 The address of a global or static data object.
  12809.                              The concept of data symbol includes all data
  12810.                              objects except local (stack-allocated) or
  12811.                              dynamically allocated data.
  12812.  Term                                       Meaning
  12813.  
  12814.                             dynamically allocated data.
  12815.  
  12816.  
  12817.  14.2  Guidelines for Using ILINK
  12818.  
  12819.  Since ILINK can automatically invoke LINK when an incremental link fails,
  12820.  you do not have to concern yourself with the following guidelines. However,
  12821.  if you are interested in how ILINK works and want to take full advantage of
  12822.  ILINK, follow the guidelines presented in this section.
  12823.  
  12824.  The incremental linker, ILINK, works much faster than the full linker
  12825.  because ILINK replaces only those modules that have changed since the last
  12826.  linking. It avoids much of the work done by LINK.
  12827.  
  12828.  To enable incremental linking, follow the major guidelines below. If your
  12829.  changes exceed the scope allowed by these guidelines, a full link is
  12830.  necessary.
  12831.  
  12832.    1. Do not alter any .LIB files you are using to create the executable
  12833.       file.
  12834.  
  12835.    2. Put padding at the end of data and small-memory-model code modules by
  12836.       specifying the /PADCODE and /PADDATA options during full linking with
  12837.       LINK.
  12838.  
  12839.       By putting padding at the end of a module, you enable the module to
  12840.       grow without forcing a full relinking. However, if the module is the
  12841.       only module contributing to its physical segment, padding is not
  12842.       necessary.
  12843.  
  12844.       You can avoid padding if you have a BASIC, Pascal, FORTRAN, or C
  12845.       program (other than a small-memory-model C program), if you do not call
  12846.       a MASM module that uses the GROUP directive, and if you do not add to
  12847.       the size of the default data segment. (See your language documentation
  12848.       for information about what is placed in the default data segment.)
  12849.  
  12850.    3. Do not delete code symbols (functions and procedures) referenced by
  12851.       another module. You can, however, move or add to these symbols.
  12852.  
  12853.    4. Do not move or delete data symbols (global data). You can add data
  12854.       symbols at the end of your data definitions, but you cannot add new
  12855.       communal data symbols (for example, C uninitialized variables or BASIC
  12856.       COMMON statements).
  12857.  
  12858.  
  12859.  14.3  The Development Process
  12860.  
  12861.  To develop a software project with ILINK, follow the steps listed below:
  12862.  
  12863.    1. Use the full linker during early stages of developing your application
  12864.       or dynamic-link library. ILINK produces no significant gain in speed
  12865.       until you have a number of different code and data modules present.
  12866.  
  12867.    2. Prepare for incremental linking by using the special liner options
  12868.       mentioned below.
  12869.  
  12870.    3. Incrementally link with ILINK after any small changes are made.
  12871.  
  12872.    4. Relink with LINK after any major changes are made (for example, if you
  12873.       want to add an entirely new module, greatly expand one of the segments
  12874.       or modules, or redefine symbols that are shared between segments).
  12875.  
  12876.    5. Repeat steps 3 and 4 as necessary.
  12877.  
  12878.  You may find it easiest to use a make file to invoke ILINK and LINK. The
  12879.  following sample make file attempts to use ILINK each time, but invokes the
  12880.  full linker whenever incremental linking is not possible:
  12881.  
  12882.       dog.exe: obj1.obj; obj2.obj; obj3.obj
  12883.           ILINK -e "LINK /incr @dog.lnk" -a dog
  12884.  
  12885.  Three options──/INCREMENTAL, /PADCODE, and /PADDATA──have been added to LINK
  12886.  to allow the use of ILINK. Here is an example of how they might appear on
  12887.  the command line:
  12888.  
  12889.       LINK /INCREMENTAL /PADDATA:16 /PADCODE:256 @PROJNAME.LNK
  12890.  
  12891.  These options are described in detail in Sections 13.3.12, 13.3.27, and
  12892.  13.3.26, respectively.
  12893.  
  12894.  
  12895.  14.4  Running ILINK
  12896.  
  12897.  You can attempt to link the project with ILINK at any time after the project
  12898.  has been linked with the /INCREMENTAL option. The following two sections
  12899.  discuss the files needed for linking with ILINK and the command required to
  12900.  invoke ILINK.
  12901.  
  12902.  
  12903.  14.4.1  Files Required for Using ILINK
  12904.  
  12905.  The files that are required for linking using ILINK are ILINK.EXE,
  12906.  ILINKSTB.OVL, and your project files that include the following:
  12907.  
  12908.    1. projname.EXE (the file to be incrementally linked)
  12909.  
  12910.    2. projname.SYM (the symbol file)
  12911.  
  12912.    3. projname.ILK  (the ILINK support file)
  12913.  
  12914.    4. *.OBJ  (the changed .OBJ files)
  12915.  
  12916.  ILINK.EXE and ILINKSTB.OVL should be in a directory listed in the PATH
  12917.  environment variable, and the rest of the project files should be in the
  12918.  current directory.
  12919.  
  12920.  
  12921.  14.4.2  The ILINK Command Line
  12922.  
  12923.  The syntax for the ILINK command line is shown below. ILINK options are not
  12924.  case sensitive.
  12925.  
  12926.       ILINK «/a» «/c» «/v» «/i» «/e "commands"» projname«modulelist»
  12927.  
  12928.  The /a option specifies that all object files are to be checked to see if
  12929.  they have changed since the last linking process. This is done by comparing
  12930.  the dates and times of all .OBJ files with those of the executable file. An
  12931.  attempt is made to incrementally link all of the files that have changed.
  12932.  
  12933.  The /c option specifies case sensitivity for all public symbol names.
  12934.  
  12935.  The /v option specifies verbose mode and directs ILINK to display more
  12936.  information. Specifically, when in verbose mode ILINK lists the modules that
  12937.  have changed.
  12938.  
  12939.  The /i option specifies that only an incremental link is to be attempted. If
  12940.  the incremental link fails, a full link is not performed.
  12941.  
  12942.  The /e option specifies a list of commands to be executed if the incremental
  12943.  link fails. The commands are enclosed in double quotes, and if more than one
  12944.  command is given, they must be separated by spaces and a semicolon.
  12945.  
  12946.  The projname field contains the name of the executable file that is to be
  12947.  incrementally linked.
  12948.  
  12949.  You can use the optional modulelist field to list all the modules that have
  12950.  changed. (No extensions are required.) This field is an alternative to using
  12951.  the /a flag.
  12952.  
  12953.  Examples
  12954.  
  12955.       ILINK /i wizard input sort output
  12956.  
  12957.  In the above example, the altered modules (input, sort, and output) are
  12958.  explicitly listed on the command line.
  12959.  
  12960.       ILINK /e "link @%s.obj ; rc %s.exe" myproj
  12961.  
  12962.  In the example above, the characters %s are replaced by projname when the
  12963.  command is carried out. If the incremental link fails, ILINK carries out the
  12964.  commands link myproj.obj and rc myproj.exe.
  12965.  
  12966.       ILINK /a /e "link @%s.lnk ; rc %s.exe" wizard
  12967.  
  12968.  In the final example above, the /a option directs ILINK to scan all files in
  12969.  the project in order to discover which modules have changed. This example
  12970.  also lists commands to be executed in case incremental linking fails.
  12971.  
  12972.  
  12973.  14.5  How ILINK Works
  12974.  
  12975.  Instead of searching for records and resolving external references for the
  12976.  entire program, ILINK carries out the following operations:
  12977.  
  12978.    1. ILINK replaces the portion of each module that has changed since the
  12979.       last linking (incremental or full linking).
  12980.  
  12981.    2. ILINK alters relocation-table entries for any far (segmented) code
  12982.       symbols that have moved within a segment. For each reference to a far
  12983.       code symbol, such as a far function call, there is an entry in the
  12984.       relocation table in the executable file's header. The relocation table
  12985.       of the application contains full addresses. Therefore, by fixing
  12986.       relocation table entries for a code symbol, ILINK ensures that all
  12987.       references to the symbol will be correct.)
  12988.  
  12989.  ILINK makes no modification to modules that have not been changed since the
  12990.  last linking.
  12991.  
  12992.  
  12993.  14.6  Incremental Violations
  12994.  
  12995.  There are two kinds of ILINK failures: real errors and incremental
  12996.  violations. Real errors are errors that will not be resolved by a full link,
  12997.  such as undefined symbols or invalid .OBJ files. If ILINK detects a real
  12998.  error, it displays ERROR with an explanation and returns a nonzero error
  12999.  code to the operating system. Incremental violations consist of changes that
  13000.  are beyond the scope of incremental linking, but can generally be resolved
  13001.  by full linking.
  13002.  
  13003.  Section C.2, "LINK Error Messages," explains real errors in detail. The rest
  13004.  of this section describes incremental violations.
  13005.  
  13006.  
  13007.  14.6.1  Changing Libraries
  13008.  
  13009.  An incremental violation occurs when a library changes. Furthermore, if an
  13010.  altered module shares a code segment with a library, ILINK needs access to
  13011.  the library as well as to the new module.
  13012.  
  13013.  ───────────────────────────────────────────────────────────────────────────
  13014.  NOTE
  13015.     If you add a function, procedure, or subroutine call to a library that
  13016.     has never been called before, ILINK fails with an undefined-symbol error.
  13017.     Performing a full link should resolve this problem.
  13018.  ───────────────────────────────────────────────────────────────────────────
  13019.  
  13020.  
  13021.  14.6.2  Exceeding Code/Data Padding
  13022.  
  13023.  An incremental violation will occur if two or more modules contribute to the
  13024.  same physical segment and either module exceeds its padding. As discussed in
  13025.  Section 14.2, "Guidelines for Using ILINK," padding is the process of
  13026.  adding filler bytes to the end of a module. The filler bytes serve as a
  13027.  buffer zone whenever the module grows in size──that is, whenever the new
  13028.  version of the module is larger than the old.
  13029.  
  13030.  
  13031.  14.6.3  Moving/Deleting Data Symbols
  13032.  
  13033.  An incremental violation occurs if a data symbol is moved or deleted. To add
  13034.  new data symbols without requiring a full link, add the new symbols at the
  13035.  end of all other data symbols in the module.
  13036.  
  13037.  
  13038.  14.6.4  Deleting Code Symbols
  13039.  
  13040.  You can move or add code symbols, but an incremental violation occurs if you
  13041.  delete any code symbols from a module. Code symbols can be moved within a
  13042.  module but cannot be moved between modules.
  13043.  
  13044.  
  13045.  14.6.5  Changing Segment Definitions
  13046.  
  13047.  An incremental violation results if you add, delete, or change the order of
  13048.  segment definitions. If you are programming in MASM, an incremental
  13049.  violation will also result if you alter any GROUP directives.
  13050.  
  13051.  If you are programming with a high-level language, remember not to add or
  13052.  delete modules between incremental links.
  13053.  
  13054.  
  13055.  14.6.6  Adding CodeView Debugger Information
  13056.  
  13057.  If you included CodeView debugger information for a module the last time you
  13058.  ran a full link (by compiling and linking with CodeView debugger support),
  13059.  ILINK fully supports CodeView debugger information for the module. ILINK
  13060.  maintains symbolic information for current symbols, and it adds information
  13061.  for any new symbols. However, if you include CodeView debugger information
  13062.  for a module that previously did not have CodeView debugger support, an
  13063.  incremental violation results.
  13064.  
  13065.  
  13066.  Chapter 15  Managing Libraries with LIB
  13067.  ───────────────────────────────────────────────────────────────────────────
  13068.  
  13069.  The Microsoft Library Manager (LIB) is a utility designed to help you
  13070.  create, organize, and maintain run-time libraries. "Run-time" libraries are
  13071.  collections of compiled or assembled functions that provide a common set of
  13072.  useful routines. After you have linked a program with a run-time library
  13073.  file, that program can call a run-time routine exactly as if the function
  13074.  were included in the program. The call to the run-time routine is resolved
  13075.  by finding that routine in the library file.
  13076.  
  13077.  Run-time libraries are created by combining separately compiled object files
  13078.  into one library file. Library files are usually identified by their .LIB
  13079.  extension, although other extensions are allowed.
  13080.  
  13081.  In addition to accepting DOS object files and library files, LIB can read
  13082.  the contents of 286 XENIX(R) archives and Intel-style libraries and combine
  13083.  their contents with DOS libraries. To see how you can add the contents of a
  13084.  286 XENIX archive or an Intel-style library to a DOS library, refer to
  13085.  Section 15.2.8, "Combining Libraries."
  13086.  
  13087.  Using LIB, you can create a new library file, add object files to an
  13088.  existing library, delete library modules, replace library modules, and
  13089.  create object files from library modules. LIB also lets you combine the
  13090.  contents of two libraries into one library file.
  13091.  
  13092.  The command syntax is straightforward: you can give LIB all the input it
  13093.  requires directly from the command line. You can also use one of the two
  13094.  alternative methods of invoking LIB by responding to prompts or by creating
  13095.  a response file, described in Sections 15.1.2 and 15.1.3 below.
  13096.  
  13097.  
  13098.  15.1  Managing Libraries
  13099.  
  13100.  You run LIB by typing the LIB command on the DOS command line. You can
  13101.  specify the input required for this command in one of three ways:
  13102.  
  13103.    1. By placing it on the command line
  13104.  
  13105.    2. By responding to prompts
  13106.  
  13107.    3. By specifying a file containing responses to prompts (This type of file
  13108.       is known as a "response file.")
  13109.  
  13110.  ───────────────────────────────────────────────────────────────────────────
  13111.  NOTE
  13112.     Once an object file is incorporated into a library, it becomes an object
  13113.     "module." LIB makes a distinction between object files and object
  13114.     modules: an object "file" exists as an independent file, while an object
  13115.     "module" is part of a larger library file. An object file can have a full
  13116.     path name, including a drive designation, directory path name, and
  13117.     file-name extension (usually .OBJ). Object modules have only a name. For
  13118.     example, B:\RUN\SORT.OBJ is an object-file name, while SORT is an
  13119.     object-module name.
  13120.  ───────────────────────────────────────────────────────────────────────────
  13121.  
  13122.  
  13123.  15.1.1  Managing Libraries with the LIB Command Line
  13124.  
  13125.  You can start LIB and specify all the input it needs from the command line.
  13126.  In this case, the LIB command line has the following form:
  13127.  
  13128.       LIB oldlibrary «options» «commands»«,«listfile»«,« newlibrary»»»«;»
  13129.  
  13130.  To tell LIB to use the default responses for the remaining fields, use a
  13131.  semicolon (;) after any field except the oldlibrary field. The semicolon
  13132.  should be the last character on the command line.
  13133.  
  13134.  Sections 15.1.1.1-15.1.1.5 below describe the input you give in each
  13135.  command-line field.
  13136.  
  13137.  15.1.1.1  Specifying the Library File
  13138.  
  13139.  Field
  13140.  
  13141.       oldlibrary«;»
  13142.  
  13143.  The oldlibrary field allows you to specify the name of the existing library
  13144.  to be used. Usually library files are named with the .LIB extension. You can
  13145.  omit the .LIB extension when you give the library-file name since LIB
  13146.  assumes that the file-name extension is .LIB. If your library file does not
  13147.  have the .LIB extension, be sure to include the extension when you give the
  13148.  library-file name. Otherwise, LIB cannot find the file.
  13149.  
  13150.  Path names are allowed with the library-file name. You can give LIB the path
  13151.  name of a library file in another directory or on another disk. There is no
  13152.  default for this field. LIB produces an error message if you do not give a
  13153.  file name.
  13154.  
  13155.  If you give the name of a library file that does not exist, LIB displays the
  13156.  following prompt:
  13157.  
  13158.       Library file does not exist. Create?
  13159.  
  13160.  Type Y to create the library file, or N to terminate LIB. This message is
  13161.  suppressed if the nonexistent library name you give is followed immediately
  13162.  by commands, a comma, or a semicolon.
  13163.  
  13164.  If you type a library name and follow it immediately with a semicolon (;),
  13165.  LIB performs only a consistency check on the given library. A consistency
  13166.  check tells you whether all the modules in the library are in usable form.
  13167.  LIB prints a message only if it finds an invalid object module; no message
  13168.  appears if all modules are intact.
  13169.  
  13170.  15.1.1.2  Specifying Options
  13171.  
  13172.  Field
  13173.  
  13174.       «options»
  13175.  
  13176.  The following list gives the options available and the function of each:
  13177.  
  13178. ╓┌───────────────────────────┌───────────────────────────────────────────────╖
  13179.  Option                      Function
  13180.  
  13181.  /PA«GESIZE»:number          This option allows you to specify the
  13182.                              library-page size of a new library or change the
  13183.                              library-page size of an existing library. The
  13184.                              page size of a library affects the alignment of
  13185.                              modules stored in the library. Modules in the
  13186.                              library are always aligned to start at a
  13187.                              position that is a multiple of the page size (in
  13188.                              bytes) from the beginning of the file. The
  13189.                              default page size for a new library is 16 bytes.
  13190.  Option                      Function
  13191.  
  13192.                             default page size for a new library is 16 bytes.
  13193.                              See Section 15.2.11, "Setting the Library Page
  13194.                              Size," for more information. The abbreviation
  13195.                              for this option is /PA.
  13196.  
  13197.  /NOI«GNORECASE»             This option tells LIB not to ignore case when
  13198.                              comparing symbols. By default, LIB ignores case.
  13199.                              Using this option allows symbols that are the
  13200.                              same except for case to be put in the same
  13201.                              library. The abbreviation for this option is
  13202.                              /NOI.
  13203.  
  13204.                              Note that if a library is built with /NOI, the
  13205.                              library is internally "marked" to indicate /NOI
  13206.                              is in effect. All libraries built with earlier
  13207.                              versions of LIB are not marked. If you combine
  13208.                              multiple libraries, and any one of them is
  13209.                              marked /NOI, then /NOI is assumed to be in
  13210.                              effect for the output library.
  13211.  Option                      Function
  13212.  
  13213.                             effect for the output library.
  13214.  
  13215.  /I«GNORECASE»               This option tells LIB to ignore case when
  13216.                              comparing symbols, as LIB does by default. Use
  13217.                              this option when you are combining a library
  13218.                              that is marked /NOI with others that are
  13219.                              unmarked and want the new library to be
  13220.                              unmarked. (See the explanation for the /NOI
  13221.                              option above.) The abbreviation for this option
  13222.                              is /I.
  13223.  
  13224.  /NOE«XTDICTIONARY»          This option is used to prevent LIB from creating
  13225.                              an extended dictionary. The extended dictionary
  13226.                              is used by LINK to speed up a library search.
  13227.                              Without an extended dictionary, the .LIB
  13228.                              extension is still a valid library, but LINK
  13229.                              takes longer to find modules in this file. Use
  13230.                              it if you get error messages U1172 or U4158. The
  13231.                              option /NOE «XTDICTIONARY» also occurs in
  13232.  Option                      Function
  13233.  
  13234.                             option /NOE «XTDICTIONARY» also occurs in
  13235.                              LINK. In LINK the option means, "do not read an
  13236.                              extended dictionary."
  13237.  
  13238.  
  13239.  15.1.1.3  Giving LIB Commands
  13240.  
  13241.  Field
  13242.  
  13243.       «commands»
  13244.  
  13245.  The commands field allows you to specify the command symbols for
  13246.  manipulating modules. To use this field, type a command symbol (such as+, -,
  13247.  -+, *, or -*), followed immediately by a module name or an object-file name.
  13248.  You can specify more than one operation in this field in any order. LIB does
  13249.  not make any changes to oldlibrary if you leave the commands field blank.
  13250.  
  13251. ╓┌───────────────────────────┌───────────────────────────────────────────────╖
  13252.  Command
  13253.  Command
  13254.  Symbol                       Meaning
  13255.  
  13256.  +                           The add command symbol. A plus sign makes an
  13257.                              object file the last module in the library file.
  13258.                              Immediately following the plus sign, give the
  13259.                              name of the object file. You may use path names
  13260.                              for the object file. LIB automatically supplies
  13261.                              the .OBJ extension so you can omit the extension
  13262.                              from the object-file name.
  13263.  
  13264.                              You can also use the plus sign to combine two
  13265.                              libraries. When you give a library name
  13266.                              following the plus sign, a copy of the contents
  13267.                              of the given library is added to the library
  13268.                              file being modified. You must include the .LIB
  13269.                              extension when you give a library-file name.
  13270.                              Otherwise, LIB uses the default .OBJ extension
  13271.                              when it looks for the file.
  13272.  
  13273.  -                           The delete command symbol. A minus sign deletes
  13274.  Command
  13275.  Symbol                       Meaning
  13276.  
  13277. -                           The delete command symbol. A minus sign deletes
  13278.                              a module from the library file. Immediately
  13279.                              following the minus sign, give the name of the
  13280.                              module to be deleted. A module name has no path
  13281.                              name and no extension.
  13282.  
  13283.  -+                          The replace command symbol. A minus sign
  13284.                              followed by a plus sign replaces a module in the
  13285.                              library. Following the replacement symbol, give
  13286.                              the name of the module to be replaced. Module
  13287.                              names have no path names and no extensions.
  13288.  
  13289.                              To replace a module, LIB deletes the given
  13290.                              module, then appends the object file having the
  13291.                              same name as the module. The object file is
  13292.                              assumed to have an .OBJ extension and to reside
  13293.                              in the current working directory.
  13294.  
  13295.  Command
  13296.  Symbol                       Meaning
  13297.  
  13298. 
  13299.  *                           The copy command symbol. An asterisk followed by
  13300.                              a module name copies a module from the library
  13301.                              file into an object file of the same name. The
  13302.                              module remains in the library file. When LIB
  13303.                              copies the module to an object file, it adds to
  13304.                              the module name the .OBJ extension and the drive
  13305.                              designation and path name of the current working
  13306.                              directory, thus forming a complete object-file
  13307.                              name. You cannot override the .OBJ extension,
  13308.                              drive designation, or path name given to the
  13309.                              object file. However, you can later rename the
  13310.                              file or copy it to any location you like.
  13311.  
  13312.  -*                          The move command symbol. A minus sign followed
  13313.                              moves an object module from the library file to
  13314.                              an object file. This operation is equivalent to
  13315.                              copying the module to an object file, as
  13316.  Command
  13317.  Symbol                       Meaning
  13318.  
  13319.                             copying the module to an object file, as
  13320.                              described above, then deleting the module from
  13321.                              the library.
  13322.  
  13323.  
  13324.  15.1.1.4  Specifying a Cross-Reference-Listing File
  13325.  
  13326.  Field
  13327.  
  13328.       «listfile»
  13329.  
  13330.  The listfile field allows you to specify a file name for a
  13331.  cross-reference-listing file. You can specify a full path name for the
  13332.  listing file to cause it to be created outside your current working
  13333.  directory. You can give the listing file any name and any extension. LIB
  13334.  does not supply a default extension if you omit the extension. The default
  13335.  when you omit the response to this prompt is the special file named  NUL,
  13336.  which tells LIB not to create a listing file.
  13337.  
  13338.  A cross-reference-listing file contains the following two lists:
  13339.  
  13340.    1. An alphabetical list of all public symbols in the library.
  13341.  
  13342.       Each symbol name is followed by the module name in which it is
  13343.       referenced.
  13344.  
  13345.    2. A list of the modules in the library.
  13346.  
  13347.       Under each module name is an alphabetical listing of the public symbols
  13348.       defined in that module.
  13349.  
  13350.  15.1.1.5  Specifying an Output Library
  13351.  
  13352.  Field
  13353.  
  13354.       «newlibrary»
  13355.  
  13356.  The newlibrary field allows you to specify the name of the new library file
  13357.  that contains the specified changes. You need not give this name unless you
  13358.  specify changes to the library in the commands field. The default is the
  13359.  current library-file name.
  13360.  
  13361.  If you do not specify a new library-file name, the original, unmodified
  13362.  library is saved in a library file with the same name but with a .BAK
  13363.  extension replacing the .LIB extension.
  13364.  
  13365.  Examples
  13366.  
  13367.       LIB LANG-+HEAP;
  13368.  
  13369.  The example above uses the replace command symbol (-+) to instruct LIB to
  13370.  replace the HEAP module in the library LANG.LIB. LIB deletes the HEAP
  13371.  module from the library, then appends the object file HEAP.OBJ as a new
  13372.  module in the library. The semicolon at the end of the command line tells
  13373.  LIB to use the default responses for the remaining prompts. This means no
  13374.  listing file is created and the changes are written to the original library
  13375.  file instead of a new library file.
  13376.  
  13377.       LIB LANG-HEAP+HEAP;
  13378.  
  13379.       LIB LANG+HEAP-HEAP;
  13380.  
  13381.  The examples above perform the same function as the first example in this
  13382.  section, but in two separate operations, using the add (+) and delete (-)
  13383.  command symbols. The effect is the same for these examples because delete
  13384.  operations are always carried out before add operations, regardless of the
  13385.  order of the operations in the command line. This order of execution
  13386.  prevents confusion when a new version of a module replaces an old version in
  13387.  the library file.
  13388.  
  13389.       LIB FOR;
  13390.  
  13391.  The example above causes LIB to perform a consistency check of the library
  13392.  file FOR.LIB. No other action is performed. LIB displays any consistency
  13393.  errors it finds and returns to the operating-system level.
  13394.  
  13395.       LIB LANG,LCROSS.PUB
  13396.  
  13397.  This example tells LIB to perform a consistency check of the library file
  13398.  LANG.LIB and then create a cross-reference-listing file named LCROSS.PUB.
  13399.  
  13400.       LIB FIRST -*STUFF *MORE, ,SECOND
  13401.  
  13402.  This last example instructs LIB to move the module STUFF from the library
  13403.  FIRST.LIB to an object file called STUFF.OBJ. The module STUFF is removed
  13404.  from the library in the process. The module MORE is copied from the library
  13405.  to an object file called MORE.OBJ; the module remains in the library. The
  13406.  revised library is called SECOND.LIB. It contains all the modules in
  13407.  FIRST.LIB except STUFF,  which was removed by using the move command symbol
  13408.  (-*). The original library, FIRST.LIB, remains unchanged.
  13409.  
  13410.  
  13411.  15.1.2  Managing Libraries with the LIB Prompts
  13412.  
  13413.  If you want to respond to individual prompts to give input to LIB, start LIB
  13414.  at the DOS command level by typing LIB. The library manager prompts you for
  13415.  the input it needs by displaying the following four messages, one at a time:
  13416.  
  13417.       Library name:
  13418.       Operations:
  13419.       List file:
  13420.       Output library:
  13421.  
  13422.  LIB waits for you to respond to each prompt, then prints the next prompt.
  13423.  
  13424.  The responses you give to the LIB command prompts correspond to the fields
  13425.  on the LIB command line. (See Section 15.1.1 for a discussion of the LIB
  13426.  command line.) The following list shows these correspondences:
  13427.  
  13428.  Prompt                      Command-Line Field
  13429.  
  13430.  Library name                The oldlibrary field and the options (see
  13431.                              Sections 15.1.1.1 and 15.1.1.2, respectively).
  13432.                              If you want to perform a consistency check on
  13433.                              the library, type a semicolon (;) immediately
  13434.                              after the library name.
  13435.  
  13436.  Operations                  Any of the commands allowed in the commands
  13437.                              field (see Section 15.1.1.3).
  13438.  
  13439.  List file                   The listfile field (see Section 15.1.1.4).
  13440.  
  13441.  Output library              The newlibrary field (see Section 15.1.1.5).
  13442.  
  13443.  15.1.2.1  Extending Lines
  13444.  
  13445.  If you have many operations to perform during a library session, use the
  13446.  ampersand command symbol (&) to extend the operations line. Give the
  13447.  ampersand symbol after an object-module or object-file name; do not put the
  13448.  ampersand between an operation's symbol and a name.
  13449.  
  13450.  The ampersand causes LIB to repeat the Operations prompt, allowing you to
  13451.  type more operations.
  13452.  
  13453.  15.1.2.2  Using Default Responses
  13454.  
  13455.  After any entry but the first, use a single semicolon (;) followed
  13456.  immediately by a carriage return to select default responses to the
  13457.  remaining prompts. You can use the semicolon command symbol with the
  13458.  command-line and response-file methods of invoking LIB, but it is not
  13459.  necessary since LIB supplies the default responses wherever you omit
  13460.  responses.
  13461.  
  13462.  The following list shows the defaults for LIB prompts:
  13463.  
  13464.  Prompt                      Default
  13465.  
  13466.  Operations                  No operation; no change to library file.
  13467.  
  13468.  List file                   The special file name NUL, which tells LIB not
  13469.                              to create a listing file.
  13470.  
  13471.  Output library              The current library name. Only if you specify at
  13472.                              least one operation at the Operations prompt
  13473.                              will this prompt appear.
  13474.  
  13475.  
  13476.  15.1.3  Managing Libraries with a Response File
  13477.  
  13478.  To operate LIB with a response file, you must first set up the response file
  13479.  and then type the following at the DOS command line:
  13480.  
  13481.       LIB @responsefile
  13482.  
  13483.  The responsefile is the name of a response file. The response-file name can
  13484.  be qualified with a drive and directory specification to name a response
  13485.  file from a directory other than the current working directory.
  13486.  
  13487.  You can also enter the name of a response file at any position in a command
  13488.  line or after any of the linker prompts. The input from the response file is
  13489.  treated exactly as if it had been entered in command lines or after prompts.
  13490.  A carriage-return and line-feed combination in the response file is treated
  13491.  the same as pressing ENTER in response to a prompt or using a comma in a
  13492.  command line.
  13493.  
  13494.  Before you use this method, you must set up a response file containing
  13495.  responses to the LIB prompts. This method lets you conduct the library
  13496.  session without typing responses to prompts at the keyboard.
  13497.  
  13498.  A response file has one text line for each prompt. Responses must appear in
  13499.  the same order as the command prompts appear. Use command symbols in the
  13500.  response file the same way you would use responses typed on the keyboard.
  13501.  You can type an ampersand at the end of the response to the Operations
  13502.  prompt and continue typing operations on the next line.
  13503.  
  13504.  When you run LIB with a response file, the prompts are displayed with the
  13505.  responses from the response file. If the response file does not contain
  13506.  responses for all the prompts, LIB uses the default responses.
  13507.  
  13508.  Example
  13509.  
  13510.       LIBFOR
  13511.       +CURSOR+HEAP-HEAP*FOIBLES
  13512.       CROSSLST
  13513.  
  13514.  The contents of the above response file cause LIB to delete the module HEAP
  13515.  from the LIBFOR.LIB library file, copy the module FOIBLES, place it in an
  13516.  object file FOIBLES.OBJ, and append the object files CURSOR.OBJ and HEAP.OBJ
  13517.  as the last two modules in the library. LIB creates a
  13518.  cross-reference-listing file named CROSSLST.
  13519.  
  13520.  
  13521.  15.1.4  Terminating the LIB Session
  13522.  
  13523.  You can press CTRL+C at any time during a library session to terminate the
  13524.  session and return to DOS. If you notice that you have entered an incorrect
  13525.  response at a previous prompt, you should press CTRL+C to exit LIB and begin
  13526.  again. You can use the normal DOS editing keys to correct errors at the
  13527.  current prompt.
  13528.  
  13529.  
  13530.  15.2  Performing Library-Management Tasks with LIB
  13531.  
  13532.  You can perform a number of library-management functions with LIB, including
  13533.  the following tasks:
  13534.  
  13535.    ■  Create a library file
  13536.    ■  Delete modules
  13537.    ■  Copy a module to a separate object file
  13538.    ■  Move a module out of a library and into an object file (extract module)
  13539.    ■  Append an object file as a module of a library
  13540.    ■  Replace a module in the library file with a new module
  13541.    ■  Produce a listing of all public symbols in the library modules
  13542.  
  13543.  For each library session, LIB reads and interprets the user's commands in
  13544.  the order listed below. It determines whether a new library is being created
  13545.  or an existing library is being examined or modified.
  13546.  
  13547.    1. LIB processes any deletion and move commands.
  13548.  
  13549.       LIB does not actually delete modules from the existing file. Instead,
  13550.       it marks the selected modules for deletion, creates a new library file,
  13551.       and copies only the modules not marked for deletion into the new
  13552.       library file.
  13553.  
  13554.    2. LIB processes any additional commands.
  13555.  
  13556.       Like deletions, additions are not performed on the original library
  13557.       file. Instead, the additional modules are appended to the new library
  13558.       file. (If there were no deletion or move commands, a new library file
  13559.       would be created in the addition stage by copying the original library
  13560.       file.)
  13561.  
  13562.  As LIB carries out these commands, it reads the object modules in the
  13563.  library, checks them for validity, and gathers the information necessary to
  13564.  build a library index and a listing file. The linker uses the library index
  13565.  to search the library.
  13566.  
  13567.  The listing file contains a list of all public symbols in the index and the
  13568.  names of the modules in which they are defined. LIB produces the listing
  13569.  file only if you ask for it during the library session.
  13570.  
  13571.  LIB never makes changes to the original library; it copies the library and
  13572.  makes changes to the copy. Therefore, when you terminate LIB for any reason,
  13573.  you do not lose your original file. It also means that when you run LIB,
  13574.  enough space must be available on your disk for both the original library
  13575.  file and the copy.
  13576.  
  13577.  When you change a library file, LIB lets you specify a different name for
  13578.  the file containing the changes. If you use this option, the modified
  13579.  library is stored under the name you give, and the original, unmodified
  13580.  version is preserved under its own name. If you choose not to give a new
  13581.  name, LIB gives the modified file the original library name, but keeps a
  13582.  backup copy of the original library file. This copy has the extension .BAK
  13583.  instead of .LIB.
  13584.  
  13585.  
  13586.  15.2.1  Creating a Library File
  13587.  
  13588.  To create a new library file, give the name of the library file you want to
  13589.  create in the oldlibrary field of the command line or at the Library name
  13590.  prompt. LIB supplies the .LIB extension.
  13591.  
  13592.  The name of the new library file must not be the name of an existing file.
  13593.  If it is, LIB assumes that you want to change the existing file. When you
  13594.  give the name of a library file that does not currently exist, LIB displays
  13595.  the following prompt:
  13596.  
  13597.       Library file does not exist. Create?
  13598.  
  13599.  Type y to create the file, or n to terminate the library session. This
  13600.  message is suppressed if the nonexistent library name you give is followed
  13601.  immediately by commands, a comma, or a semicolon.
  13602.  
  13603.  You can specify a page size for the library when you create it. The default
  13604.  page size is 16 bytes. See Section 15.2.11, "Setting the Library-Page Size,"
  13605.  for a discussion of this option.
  13606.  
  13607.  Once you have given the name of the new library file, you can insert object
  13608.  modules into the library by using the add +) in the commands field of the
  13609.  command line or at the Operations prompt. You can also add the contents of
  13610.  another library, if you wish. See Section 15.2.3, "Adding Library Modules,"
  13611.  and Section 15.2.8, "Combining Libraries," for a discussion of these
  13612.  options.
  13613.  
  13614.  
  13615.  15.2.2  Changing a Library File
  13616.  
  13617.  You can change an existing library file by giving the name of the library
  13618.  file at the Library name prompt. All operations you specify in the
  13619.  oldlibrary field of the command line or at the Operations prompt are
  13620.  performed on that library.
  13621.  
  13622.  However, LIB lets you keep both the unchanged library file and the newly
  13623.  changed version, if you like. You can do this by giving the name of a new
  13624.  library file in the newlibrary field or at the Output library prompt. The
  13625.  changed library file is stored under the new library-file name, while the
  13626.  original library file remains unchanged.
  13627.  
  13628.  If you don't give a new file name, the changed version of the library file
  13629.  replaces the original library file. Even in this case, LIB saves the
  13630.  original, unchanged library file with the extension .BAK instead of .LIB.
  13631.  Thus, at the end of the session you have two library files: the changed
  13632.  version with the .LIB extension and the original, unchanged version with the
  13633.  .BAK extension.
  13634.  
  13635.  
  13636.  15.2.3  Adding Library Modules
  13637.  
  13638.  Use the add command symbol (+) in the commands field of the command line or
  13639.  at the Operations prompt to add an object module to a library. Give the name
  13640.  of the object file to be added without the .OBJ extension, immediately
  13641.  following the plus sign.
  13642.  
  13643.  LIB strips the drive designation and the extension from the object-file
  13644.  specification, leaving only the base name. This becomes the name of the
  13645.  object module in the library. For example, if the object file B:\CURSOR is
  13646.  added to a library file, the name of the corresponding object module is
  13647.  CURSOR.
  13648.  
  13649.  Object modules are always added to the end of a library file.
  13650.  
  13651.  
  13652.  15.2.4  Deleting Library Modules
  13653.  
  13654.  Use the delete command symbol (-+) in the commands field of the command line
  13655.  or at the Operations prompt to delete an object module from a
  13656.  library. After the minus sign, give the name of the module to be deleted. A
  13657.  module name does not have a path name or extension; it is simply a name,
  13658.  such as CURSOR.
  13659.  
  13660.  
  13661.  15.2.5  Replacing Library Modules
  13662.  
  13663.  Use the replace command symbol (-+) in the commands field to replace a
  13664.  module in the library. Following the replace command symbol, give the name
  13665.  of the module to be replaced. Remember that module names do not have path
  13666.  names or extensions.
  13667.  
  13668.  To replace a module, LIB deletes the given module, then appends the object
  13669.  file having the same name as the module. The object file is assumed to have
  13670.  an .OBJ extension and to reside in the current working directory.
  13671.  
  13672.  
  13673.  15.2.6  Copying Library Modules
  13674.  
  13675.  To copy a module from the library file into an object file of the same name,
  13676.  use the copy command symbol (*) followed by a module name in the commands
  13677.  field. The module remains in the library file. When LIB copies the module to
  13678.  an object file, it adds the .OBJ extension and the drive designation and
  13679.  path name of the current working directory to the module name. This forms a
  13680.  complete object-file name. You cannot override the .OBJ extension, drive
  13681.  designation, or path name given to the object file, but you can later rename
  13682.  the file or copy it to any location you like.
  13683.  
  13684.  
  13685.  15.2.7  Moving Library Modules (Extracting)
  13686.  
  13687.  Use the move c field to move an object module from the library file to an
  13688.  object file. This operation is equivalent to copying the module to an object
  13689.  file, then deleting the module from the library.
  13690.  
  13691.  
  13692.  15.2.8  Combining Libraries
  13693.  
  13694.  You can add another library by using the add command symbol (+) with a
  13695.  library-file name instead of an object-file name in the commands field. In
  13696.  the commands field or at the Operations prompt, give the add command symbol
  13697.  (+) followed by the name of the library whose contents you wish to add to
  13698.  the library being changed. When you use this option, you must include the
  13699.  .LIB extension of the library-file name. Otherwise, LIB assumes that the
  13700.  file is an object file and looks for the file with an .OBJ extension.
  13701.  
  13702.  In addition to DOS libraries as input, LIB also accepts 286 XENIX archives
  13703.  and Intel-format libraries. Therefore, you can use LIB to convert libraries
  13704.  from either of these formats to the DOS format.
  13705.  
  13706.  LIB adds the modules of the library to the end of the library being changed.
  13707.  Note that the added library still exists as an independent library. LIB
  13708.  copies the modules without deleting them.
  13709.  
  13710.  Once you have added the contents of a library or libraries, you can save the
  13711.  new, combined library under a new name by giving a new name in the
  13712.  newlibrary field of the command line or at the Output library prompt. If you
  13713.  omit the Output library response, LIB saves the combined library under the
  13714.  name of the original library being changed. The original library is saved
  13715.  with the same base name and the extension .BAK.
  13716.  
  13717.  
  13718.  15.2.9  Creating a Cross-Reference-Listing File
  13719.  
  13720.  Create a cross-reference-listing file by giving a name for the listing file
  13721.  in the listfile field of the command line or at the List file prompt. If you
  13722.  do not give a listing-file name, LIB uses the special file name NUL, which
  13723.  means no listing file is created.
  13724.  
  13725.  You can give the listing file any name and any extension. To cause the
  13726.  listing file to be created outside your current working directory, you can
  13727.  specify a full path name, including drive designation. LIB does not supply a
  13728.  default extension if you omit the extension.
  13729.  
  13730.  A cross-reference-listing file contains two lists. The first is an
  13731.  alphabetical listing of all public symbols in the library. Each symbol name
  13732.  is followed by the name of the module in which it is referenced.
  13733.  
  13734.  The second list is an alphabetical list of the modules in the library. Under
  13735.  each module name is an alphabetical listing of the public symbols referenced
  13736.  in that module.
  13737.  
  13738.  
  13739.  15.2.10  Performing Consistency Checks
  13740.  
  13741.  When you give only a library name followed by a semicolon in the oldlibrary
  13742.  field of the command line or at the Library name prompt, LIB performs a
  13743.  consistency check, displaying messages about any errors it finds. No changes
  13744.  are made to the library. It is not usually necessary to perform consistency
  13745.  checks since LIB automatically checks object files for consistency before
  13746.  adding them to the library.
  13747.  
  13748.  To produce a cross-reference-listing file with a consistency check, invoke
  13749.  LIB, specify the library name followed by a semicolon, and give the name of
  13750.  the listing file. LIB then performs the consistency check and creates the
  13751.  cross-reference-listing file.
  13752.  
  13753.  
  13754.  15.2.11  Setting the Library-Page Size
  13755.  
  13756.  You can set the library-page size while you are creating a library, and you
  13757.  can change the page size of an existing library by adding a page-size option
  13758.  after the library-file name in the LIB command line or after the new
  13759.  library-file name at the Library name prompt. The option has the following
  13760.  form:
  13761.  
  13762.       /PA«GESIZE» :number
  13763.  
  13764.  The number specifies the new page size. It must be an integer value
  13765.  representing a power of 2 between the values 16 and 32,768.
  13766.  
  13767.  The page size of a library affects the alignment of modules stored in the
  13768.  library. Modules in the library are always aligned to start at a position
  13769.  that is a multiple of the page size (in bytes) from the beginning of the
  13770.  file. The default page size is 16 bytes for a new library or the current
  13771.  page size for an existing library.
  13772.  
  13773.  ───────────────────────────────────────────────────────────────────────────
  13774.  NOTE
  13775.     Because of the indexing technique used by LIB, a library with a large page
  13776.     size can hold more modules than a library with a smaller page size.
  13777.     However, for each module in the library, an average of pagesize/2 bytes
  13778.     of storage space is wasted. In most cases, a small page size is
  13779.     advantageous; you should use a small page size unless you need to put a
  13780.     very large number of modules in a library.
  13781.  
  13782.     Another consequence of this indexing technique is that the page size
  13783.     determines the maximum possible size of the .LIB file. Specifically,
  13784.     this limit is number * 65,536. For example, /P:16 means that the .LIB
  13785.     file has to be smaller than 1 megabyte (16 * 65,536 bytes).
  13786.  ───────────────────────────────────────────────────────────────────────────
  13787.  
  13788.  
  13789.  Chapter 16  NMAKE
  13790.  ───────────────────────────────────────────────────────────────────────────
  13791.  
  13792.  The Microsoft Program-Maintenance Utility (NMAKE) can save you time by
  13793.  automating the process of updating project files. NMAKE compares the
  13794.  modification dates for one set of files, the target files, to those of
  13795.  another set of files, the dependent files. If any of the dependent files
  13796.  have changed more recently than the target files, NMAKE executes a specified
  13797.  series of commands.
  13798.  
  13799.  NMAKE is typically used by specifying a project's executable files as target
  13800.  files and the project's source files as the dependent files. If any of the
  13801.  source files have changed since the executable file was created, NMAKE can
  13802.  issue a command to assemble or compile the changed source files and link
  13803.  them into the executable file.
  13804.  
  13805.  NMAKE reads the target- and dependent-file specifications from a
  13806.  "description file," also called a "makefile." The description file comprises
  13807.  any number of description blocks. Each description block lists one or more
  13808.  targets and the dependent files related to those targets. The block also
  13809.  gives the commands that NMAKE must execute to bring the targets up to date.
  13810.  The description file may also contain macros, inference rules, and
  13811.  directives.
  13812.  
  13813.  
  13814.  16.1  Invoking NMAKE
  13815.  
  13816.  Two methods for invoking NMAKE are available:
  13817.  
  13818.    1. Specify options, macro definitions, and the names of targets to be
  13819.       built on the DOS command line.
  13820.  
  13821.    2. Specify options, macro definitions, and the names of targets to be
  13822.       built in a command file, and give the file name on the DOS command
  13823.       line.
  13824.  
  13825.  
  13826.  16.1.1  Using a Command Line to Invoke NMAKE
  13827.  
  13828.  The syntax for invoking NMAKE from the command line is as follows:
  13829.  
  13830.       NMAKE «options» «macrodefinitions» «target...» «filename»
  13831.  
  13832.  The options field specifies options that modify the action of NMAKE.
  13833.  (Options are not required.) They are described in Section 16.2.
  13834.  
  13835.  The optional macrodefinitions field lists macro definitions for NMAKE to
  13836.  use. Macros provide a convenient method for replacing a string of text in
  13837.  the description file. Macro definitions that contain spaces must be enclosed
  13838.  by quotation marks. Macros are discussed in Section 16.3.2.
  13839.  
  13840.  The optional target... field specifies the name of one or more targets to
  13841.  build. If you do not list any targets, NMAKE builds the first target in the
  13842.  description file.
  13843.  
  13844.  The optional filename field gives the name of the description file from
  13845.  which NMAKE reads target- and dependent-file specifications and commands. A
  13846.  better way of designating the description file is to use the /F option
  13847.  (described in Section 16.2). By default, NMAKE looks for a file named
  13848.  MAKEFILE in the current directory. If MAKEFILE does not exist, NMAKE uses
  13849.  the filename field; it interprets the first string on the command line that
  13850.  is not an option or macro definition as the name of the description file,
  13851.  provided its file-name extension isn't listed in the .SUFFIXES list. (See
  13852.  Section 16.3.5 for more information on the .SUFFIXES list.)
  13853.  
  13854.  ───────────────────────────────────────────────────────────────────────────
  13855.  NOTE
  13856.     Unless you use the /F option, NMAKE always searches for a file named
  13857.     MAKEFILE in the current directory.
  13858.  ───────────────────────────────────────────────────────────────────────────
  13859.  
  13860.  Example
  13861.  
  13862.       NMAKE /S "program = flash" sort.exe search.exe
  13863.  
  13864.  This example invokes NMAKE with the /S option, a macro assigning flash to
  13865.  program, and two targets, sort.exe and search.exe. By default, NMAKE uses
  13866.  the file named MAKEFILE as the description file.
  13867.  
  13868.  
  13869.  16.1.2  Using a Command File to Invoke NMAKE
  13870.  
  13871.  To invoke NMAKE with a command file, first create the command file, then
  13872.  issue a command with the following syntax:
  13873.  
  13874.       NMAKE @commandfile
  13875.  
  13876.  Here commandfile is the name of a file containing the same information that
  13877.  would be specified on the command line: options, macro definitions, and
  13878.  targets. The command file is not the same as the description file.
  13879.  
  13880.  A command file is useful for invoking NMAKE with a long string of
  13881.  command-line arguments, such as macro definitions, that might exceed the DOS
  13882.  limit of 128 characters. NMAKE treats line breaks that occur between
  13883.  arguments as spaces. Macro definitions can span multiple lines by ending
  13884.  each line except the last with a backslash ( \). Macro definitions that
  13885.  contain spaces must be enclosed by quotation marks, just as if they were
  13886.  entered directly on the command line.
  13887.  
  13888.  Example
  13889.  
  13890.       /S "program \
  13891.       = flash" sort.exe search.exe
  13892.  
  13893.  Assume a file named update contains the text above. The command below
  13894.  invokes NMAKE with the description file MAKEFILE, the /S option, the macro
  13895.  definition program = flash, and the targets sort.exe and search.exe. Note
  13896.  that the backslash ending the line allows the macro definition to span two
  13897.  lines.
  13898.  
  13899.       NMAKE @update
  13900.  
  13901.  
  13902.  16.2  NMAKE Options
  13903.  
  13904.  NMAKE accepts a number of command-line options, which are listed below. You
  13905.  may specify options in uppercase or lowercase and use either a slash or
  13906.  dash. For example, -B, /B, -b, and /b all represent the same option.
  13907.  
  13908. ╓┌──────────────────────────┌────────────────────────────────────────────────╖
  13909.  Option                     Action
  13910.  
  13911.  /A                         Executes commands to build all the targets
  13912.                             requested even if they are not out of date.
  13913.  
  13914.  /C                         Suppresses the NMAKE copyright message and
  13915.                             prevents nonfatal error or warning messages from
  13916.                             being displayed.
  13917.  
  13918.  /D                         Displays the modification date of each file when
  13919.                             the date is checked.
  13920.  
  13921.  /E                         Causes environment variables to override macro
  13922.                             definitions within description files.
  13923.  
  13924.  /F filename                Specifies filename as the name of the description
  13925.  Option                     Action
  13926.  
  13927. /F filename                Specifies filename as the name of the description
  13928.                             file to use. If a dash (-) is entered instead of
  13929.                             a file name, NMAKE accepts input from the
  13930.                             standard input device instead of using a
  13931.                             description file.
  13932.  
  13933.                             If /F is not specified, NMAKE uses the file named
  13934.                             MAKEFILE as the description file. If MAKEFILE
  13935.                             does not exist, NMAKE uses the first string on
  13936.                             the command line that is not an option or macro
  13937.                             definition as the name of the file, provided the
  13938.                             extension is not listed in the .SUFFIXES list
  13939.                             (see Section 16.3.5).
  13940.  
  13941.  /I                         Ignores exit codes (also called return or
  13942.                             "errorlevel" codes) returned by programs called
  13943.                             from the NMAKE description file. NMAKE continues
  13944.                             executing the rest of the description file
  13945.                             despite the errors.
  13946.  Option                     Action
  13947.  
  13948.                            despite the errors.
  13949.  
  13950.  /N                         Displays the commands from the description file
  13951.                             that NMAKE would execute but does not execute
  13952.                             these commands. This option is useful for
  13953.                             checking which targets are out of date and for
  13954.                             debugging description files.
  13955.  
  13956.  /P                         Prints all macro definitions and target
  13957.                             descriptions.
  13958.  
  13959.  /Q                         Returns a zero status code if the target is up to
  13960.                             date and
  13961.                             a nonzero status code if it is not. This option
  13962.                             is useful when invoking NMAKE from within a batch
  13963.                             file.
  13964.  
  13965.  /R                         Ignores inference rules and macros contained in
  13966.                             the TOOLS.INI file.
  13967.  Option                     Action
  13968.  
  13969.                            the TOOLS.INI file.
  13970.  
  13971.  /S                         Does not display commands as they are executed.
  13972.  
  13973.  /T                         Changes the modification dates for out-of-date
  13974.                             target files to the current date. The file
  13975.                             contents are not
  13976.                             modified.
  13977.  
  13978.  /X filename                Sends all error output to filename, which can be
  13979.                             either a file or a device. If a dash (-) is
  13980.                             entered instead of a file name, the error output
  13981.                             is sent to the standard output device.
  13982.  
  13983.  
  13984.  Examples
  13985.  
  13986.       NMAKE /f quick /c f1 f2
  13987.  
  13988.  The example above causes NMAKE to execute the commands in the description
  13989.  file quick to update the targets f1 and f2. The /c option prevents NMAKE
  13990.  from displaying nonfatal error messages and warnings.
  13991.  
  13992.       NMAKE  /D /N f1 f1.mak
  13993.  
  13994.  In the example above, NMAKE updates the target f1. If the current directory
  13995.  does not contain a file named MAKEFILE, NMAKE reads the file f1.mak as the
  13996.  description file. The /D option displays the modification date of each file
  13997.  and the /N option displays the commands without executing them.
  13998.  
  13999.  
  14000.  16.3  Description Files
  14001.  
  14002.  NMAKE reads a description file to determine what to do. The description file
  14003.  may contain any number of description blocks, along with macros, inference
  14004.  rules, and directives. These can be in any order.
  14005.  
  14006.  When NMAKE runs, it builds the first target in the description file by
  14007.  default. You can override this default by specifying on the command line the
  14008.  names of the targets to build.
  14009.  
  14010.  The sections that follow describe the elements of a description file.
  14011.  
  14012.  
  14013.  16.3.1  Description Blocks
  14014.  
  14015.  An NMAKE description file contains one or more description blocks. Each has
  14016.  the following form:
  14017.  
  14018.      target... : «dependent...» «; command»«#comment»
  14019.      «command» «#comment» «#comment»  |  «command»      .      .      .
  14020.  
  14021.  The file to be updated is target; dependent is a file upon which target
  14022.  depends; command target; and comment documents what is happening. The line
  14023.  containing target and dependent is called the dependency line because target
  14024.  depends on dependent.
  14025.  
  14026.  Each component of a description block is discussed below.
  14027.  
  14028.  The Target Field
  14029.  
  14030.  The target field specifies the name of one or more files to update. If you
  14031.  specify more than one file, separate the file names by a space. The first
  14032.  target name must start in the first column of the line; it may not be
  14033.  preceded by any tabs or spaces. Note that the target need not be a file; it
  14034.  may be a pseudotarget, as described in Section 16.3.5. A target name can
  14035.  have a complete path specification, i.e., drive: path filename.ext. If a
  14036.  target name is a single letter, then a space must be inserted before the ":"
  14037.  to avoid confusion with a path name, such as "a:".
  14038.  
  14039.  The Dependent Field
  14040.  
  14041.  The dependent field lists one or more files on which the target depends. If
  14042.  you specify more than one file, separate the file names by a space. You can
  14043.  specify directories for NMAKE to search for the dependent files by using the
  14044.  following form:
  14045.  
  14046.       target : {directory1;directory2...}dependent
  14047.  
  14048.  NMAKE searches the current directory first, then directory1, directory2, and
  14049.  so on. If dependent cannot be found in any of these directories, NMAKE looks
  14050.  for an inference rule to create the dependent in the current directory. See
  14051.  Section 16.3.3 for more information on inference rules.
  14052.  
  14053.  In the following example, NMAKE first searches the current directory for
  14054.  pass.obj, then the \src\alpha directory, and finally the d:\proj directory:
  14055.  
  14056.       forward.exe : {\src\alpha;d:\proj}pass.obj
  14057.  
  14058.  TheCommand Field
  14059.  
  14060.  The command is used to update the target. This can be any command that can
  14061.  be issued on the DOS command line. A semicolon must precede the command if
  14062.  it is given on the same line as the target and dependent files. Commands may
  14063.  be placed on separate lines following the dependency line, but each line
  14064.  must start with at least one space or tab character. Blank lines may be
  14065.  intermixed with commands. A long command may span several lines if each line
  14066.  ends with a backslash (\). If no commands are specified, NMAKE looks for an
  14067.  inference rule to build the target.
  14068.  
  14069.  The Comment Field
  14070.  
  14071.  NMAKE considers any text between a number sign (#) and a new-line character
  14072.  to be a comment and ignores it. You may place a comment on a line by itself
  14073.  or at the end of any line except a command line. In the command section of
  14074.  the description file, comments must start in the first column.
  14075.  
  14076.  Wild-Card Characters
  14077.  
  14078.  You can use the DOS wild-card characters (* and ?) when specifying target-
  14079.  and dependent-file names. NMAKE expands wild cards in target names when it
  14080.  reads the description file. It expands wild cards in the dependent names
  14081.  when it builds the target. For example, the following description block
  14082.  compiles all source files with the .C extension:
  14083.  
  14084.       astro.exe : *.c
  14085.            QCL *.c
  14086.  
  14087.  Escape Character
  14088.  
  14089.  You can use a caret (^) to escape any DOS or OS/2 file-name character in a
  14090.  description file, so that the character takes on its literal meaning and
  14091.  does not have any special significance to NMAKE. Specifically, the caret
  14092.  escapes the following characters:
  14093.  
  14094.       # ( ) $ ^ \ { } ! @ -
  14095.  
  14096.  For example, NMAKE interprets the specification
  14097.  
  14098.       big^#.c
  14099.  
  14100.  as the file name
  14101.  
  14102.       big#.c
  14103.  
  14104.  Using the caret, you can include a literal new-line character in a
  14105.  description file. This capability is primarily useful in macro definitions,
  14106.  as in the following example:
  14107.  
  14108.       XYZ=abc^
  14109.       def
  14110.  
  14111.  NMAKE interprets this example as if you had assigned to the XYZ macro the
  14112.  C-style string abc\ndef. Note that this effect differs from the use of the
  14113.  backslash (\) to continue a line. A new-line character that follows a
  14114.  backslash is replaced with a space.
  14115.  
  14116.  NMAKE ignores a caret that is not followed by any of the characters
  14117.  mentioned above, as in the following:
  14118.  
  14119.       mno ^: def
  14120.  
  14121.  In this case, NMAKE ignores the caret and treats the line as
  14122.  
  14123.       mno : def
  14124.  
  14125.  Carets that appear within quotation marks are not treated as escape
  14126.  characters.
  14127.  
  14128.  16.3.1.2  Modifying Commands
  14129.  
  14130.  Three different characters may be placed in front of a command to modify its
  14131.  effect. The character must be preceded by at least one space, and spaces may
  14132.  separate the character from the command. You may use more than one character
  14133.  to modify a single command. The characters are listed below.
  14134.  
  14135. ╓┌──────────────────────────┌────────────────────────────────────────────────╖
  14136.  Character                  Action
  14137.  
  14138.  Dash (-)                   Turns off error checking for the command. If the
  14139.                             dash is followed by a number, NMAKE halts only if
  14140.                             the error level returned by the command is
  14141.                             greater than the number. In the following
  14142.                             example, if the program flash returned an error
  14143.                             code NMAKE would not halt, but would continue to
  14144.                             execute commands:
  14145.  
  14146.                             light.lst:light.txt
  14147.                               -flash light.txt
  14148.  
  14149.  At sign(@)                 Prevents NMAKE from displaying the command as it
  14150.                             executes. In the example below, NMAKE does not
  14151.                             display the ECHO command line:
  14152.  
  14153.                             sort.exe:sort.obj
  14154.                                @ECHO sorting
  14155.  
  14156.  Character                  Action
  14157.  
  14158. 
  14159.                             The output of the ECHO command, however, appears
  14160.                             as usual. (This modifier does not work with DOS
  14161.                             2.1.)
  14162.  
  14163.  Exclamation                Causes the command to be executed for each
  14164.  point (!)                  dependent file if the command uses one of the
  14165.                             special macros $? or $**. The $? macro refers to
  14166.                             all dependent files that are out of date with
  14167.                             respect to the target, while $** refers to all
  14168.                             dependent files in the description block. (See
  14169.                             Section 16.3.2 for more information on macros.)
  14170.                             For example,
  14171.  
  14172.                             print: hop.asm skip.bas jump.c
  14173.                                !print $** lpt1:
  14174.  
  14175.                             causes the following three commands to be
  14176.                             generated:
  14177.  Character                  Action
  14178.  
  14179.                            generated:
  14180.  
  14181.                             print hop.asm lpt1:
  14182.                             print skip.bas lpt1:
  14183.                             print jump.c lpt1:
  14184.  
  14185.  
  14186.  16.3.1.3  Specifying a Target in Multiple Description Blocks
  14187.  
  14188.  You can specify more than one description block for the same target by using
  14189.  two colons (::) as the separator instead of one. For example:
  14190.  
  14191.       target.lib :: a.asm b.asm c.asm
  14192.          ML a.asm b.asm c.asm
  14193.          LIB target -+a.obj -+b.obj -+c.obj;
  14194.       target.lib :: d.c e.c
  14195.          QCL /c d.c e.c
  14196.          LIB target -+d.obj -+e.obj;
  14197.  
  14198.  These two description blocks both update the library named target.lib. If
  14199.  any of the assembly-language files have changed more recently than the
  14200.  library file, NMAKE executes the commands in the first block to assemble the
  14201.  source files and update the library. Similarly, if any of the C-language
  14202.  files have changed, NMAKE executes the second group of commands that compile
  14203.  the C files and then update the library.
  14204.  
  14205.  If you use a single colon in the above example, NMAKE issues an error
  14206.  message. It is legal, however, to use single colons if commands are listed
  14207.  in only one block. In this case, dependency lines are cumulative. For
  14208.  example,
  14209.  
  14210.       target: jump.bas
  14211.       target: up.c
  14212.         commands
  14213.  
  14214.  is equivalent to
  14215.  
  14216.       target: jump.bas up.c
  14217.         commands
  14218.  
  14219.  
  14220.  16.3.2  Macros
  14221.  
  14222.  Macros provide a convenient way to replace a string in the description file
  14223.  with another string. The text is automatically replaced each time NMAKE is
  14224.  invoked. This feature makes it easy to change text used throughout the
  14225.  description file without having to edit every line that uses the text.
  14226.  
  14227.  Macros can be used in a variety of situations, including the following:
  14228.  
  14229.    ■  To create a standard description file for several projects. The macro
  14230.       represents the file names used in commands. These file names are then
  14231.       defined when you run NMAKE. When you switch to a different project,
  14232.       changing the macro changes the file names NMAKE uses throughout the
  14233.       description file.
  14234.  
  14235.    ■  To control the options that NMAKE passes to the compiler, assembler, or
  14236.       linker. When you use a macro to specify the options, you can quickly
  14237.       change the options used throughout the description file in one easy
  14238.       step.
  14239.  
  14240.  16.3.2.1  Macro Definitions
  14241.  
  14242.  A macro definition uses the following form:
  14243.  
  14244.       macroname = string
  14245.  
  14246.  The macroname may be any combination of alphanumeric characters and the
  14247.  underscore (_) character. The string may be any valid string.
  14248.  
  14249.  You can define macros on the NMAKE command line or in the description file.
  14250.  Because of the way DOS parses command lines, the rules for the two methods
  14251.  are slightly different.
  14252.  
  14253.  Defining Macros in Description Files
  14254.  
  14255.  In NMAKE description files, define each macro on a separate line. The first
  14256.  character of the macro name must be the first character on the line. NMAKE
  14257.  ignores spaces following macroname or preceding string. The string may be a
  14258.  null string and may contain embedded spaces. Do not enclose string in
  14259.  quotation marks; NMAKE will consider them part of the string.
  14260.  
  14261.  Defining Macros on the NMAKE Command Line
  14262.  
  14263.  On the command line, no spaces may surround the equal sign. Spaces cause DOS
  14264.  to treat macroname and string as separate tokens. Strings that contain
  14265.  embedded spaces must be enclosed in double quotation marks. Alternatively,
  14266.  you can enclose the entire macro definition──macroname and string──in
  14267.  quotation marks. The string may be a null string. C command line macro
  14268.  definitions override definitions of the same macro in the description file.
  14269.  
  14270.  After you have defined a macro, use the following to include it in a
  14271.  dependency line or command:
  14272.  
  14273.       $(macroname)
  14274.  
  14275.  The parentheses are not required if macroname is only one character long. If
  14276.  you want to use a dollar sign ($) in the file but do not want to invoke a
  14277.  macro, enter two dollar signs ($$), or use the caret (^) as an escape
  14278.  character preceding the dollar sign.
  14279.  
  14280.  When NMAKE runs, it replaces all occurrences of $(macroname) with string. If
  14281.  the macro is undefined──that is, if its name does not appear to the left of
  14282.  an equal sign in the file or on the NMAKE command line, NMAKE treats it as a
  14283.  null string. Once a macro is defined, the only way to cancel its definition
  14284.  is to use the !UNDEF directive (see Section 16.3.4).
  14285.  
  14286.  Example
  14287.  
  14288.  Assume the following text is in a file named MAKEFILE:
  14289.  
  14290.       program = flash
  14291.       c = LINK
  14292.       options =
  14293.  
  14294.       $(program).exe : $(program).obj
  14295.          $c  $(options)  $(program).obj;
  14296.  
  14297.  When you invoke NMAKE, it interprets the description block as the following:
  14298.  
  14299.       flash.exe : flash.obj
  14300.          LINK    flash.obj;
  14301.  
  14302.  16.3.2.1  Macro Substitutions
  14303.  
  14304.  Just as macros allow you to substitute text in a description file, you can
  14305.  also substitute text within a macro itself. Use the following form:
  14306.  
  14307.       $(macroname:string1 = string2)
  14308.  
  14309.  Every occurrence of string1 is replaced by string2 in the macro macroname.
  14310.  Spaces between the colon and string1 are considered part of string1. Any
  14311.  spaces following string1 or preceding string2 are ignored. If string2 is a
  14312.  null string, all occurrences of string1 are deleted from the macroname
  14313.  macro.
  14314.  
  14315.  Example
  14316.  
  14317.       SRCS = prog.c sub1.c sub2.c
  14318.  
  14319.       DUP : $(SRCS)
  14320.           echo $(srcs)
  14321.           echo $(srcs:.c=.obj)
  14322.  
  14323.  Note that the special macro $** stands for the names of all the dependent
  14324.  files (see Section 16.3.2.3). If the description file above is invoked with
  14325.  a command line that specifies both targets, NMAKE will execute the following
  14326.  commands:
  14327.  
  14328.           echo prog.c sub1.c sub2.c
  14329.       prog.c sub1.c sub2.c
  14330.           echo prog.obj sub1.obj sub2.obj
  14331.       prog.obj sub1.obj sub2.obj
  14332.  
  14333.  The macro substitution does not alter the definition of the macro SRCS, but
  14334.  replaces the listed characters. When NMAKE builds the target prog.exe, it
  14335.  picks up the definition for the special macro $** (that is, the list of
  14336.  dependents) from the dependency line, which specifies the macro substitution
  14337.  in SRCS. The same is true for the second target, DUP. In this case, however,
  14338.  no macro substitution is requested, so SRCS retains its original value, and
  14339.  $** represents the names of the C source files.
  14340.  
  14341.  16.3.2.2  Special Macros
  14342.  
  14343.  Several macros have special meaning. These macros are listed below with
  14344.  their values:
  14345.  
  14346. ╓┌──────────────────────────┌────────────────────────────────────────────────╖
  14347.  Macro                      Value
  14348.  
  14349.  $*                         The target name with the extension deleted.
  14350.  
  14351.  $@                         The full name of the current target.
  14352.  
  14353.  $**                        The complete list of dependent files.
  14354.  
  14355.  $<                         The dependent file that is out of date with
  14356.                             respect to the target (evaluated only for
  14357.                             inference rules).
  14358.  
  14359.  $?                         The list of dependents that are out of date with
  14360.                             respect to the target.
  14361.  
  14362.  $$@                        The target NMAKE is currently evaluating. This is
  14363.                             a dynamic dependency parameter that can be used
  14364.                             only in dependency lines. See "Examples," below,
  14365.                             for a typical use of this macro.
  14366.  Macro                      Value
  14367.  
  14368.                            for a typical use of this macro.
  14369.  
  14370.  $(CC)                      The command to invoke the C compiler. By default,
  14371.                             NMAKE predefines this macro as CC = cl, which
  14372.                             invokes the Microsoft C Optimizing Compiler. To
  14373.                             redefine the macro to invoke the QuickC compiler,
  14374.                             use
  14375.  
  14376.                             CC = qcl
  14377.  
  14378.                             You might want to place the above definition in
  14379.                             your TOOLS.INI file to avoid having to redefine
  14380.                             it for each description file.
  14381.  
  14382.  $(AS)                      The command that invokes the Microsoft Macro
  14383.                             Assembler. NMAKE predefines this macro as
  14384.                             AS = masm.
  14385.  
  14386.  $(MAKE)                    The name with which the NMAKE utility was
  14387.  Macro                      Value
  14388.  
  14389. $(MAKE)                    The name with which the NMAKE utility was
  14390.                             invoked. This macro is used to invoke NMAKE
  14391.                             recursively. It causes the line on which it
  14392.                             appears to be executed even if the /N option is
  14393.                             on. You may redefine this macro if you want to
  14394.                             execute another program.
  14395.  
  14396.  $(MAKEFLAGS)               The NMAKE options currently in effect. If you
  14397.                             invoke NMAKE recursively, you should use the
  14398.                             command: $(MAKE). You cannot redefine this macro.
  14399.  
  14400.  
  14401.  You can append characters to any of the first six macros in the above list
  14402.  to modify its meaning. Appending a D specifies the directory part of the
  14403.  file name only, an F specifies the file name, a B specifies just the base
  14404.  name, and an R specifies the complete file name without the extension. If
  14405.  you add one of these characters, you must enclose the macro name in
  14406.  parentheses. (The special macros $$@ and $** are the only exceptions to the
  14407.  rule that macro names more than one character long must be enclosed in
  14408.  parentheses.)
  14409.  
  14410.  For example, assume that $@ has the value C:\SOURCE\PROG\SORT.OBJ. The list
  14411.  below shows the effect the special characters have when combined with $@:
  14412.  
  14413.  Macro                      Value
  14414.  
  14415.  $(@D)                      C:\SOURCE\PROG
  14416.  
  14417.  $(@F)                      SORT.OBJ
  14418.  
  14419.  $(@B)                      SORT
  14420.  
  14421.  $(@R)                      C:\SOURCE\PROG\SORT
  14422.  
  14423.  Examples
  14424.  
  14425.       trig.lib : sin.obj cos.obj arctan.obj
  14426.               !LIB trig.lib -+$?;
  14427.  
  14428.  In the example above, the macro $? represents the names of all dependents
  14429.  that are more recent than the target. The exclamation point causes NMAKE to
  14430.  execute the LIB command once for each dependent in the list. As a result of
  14431.  this description, the LIB command is executed up to three times, each time
  14432.  replacing a module with a newer version.
  14433.  
  14434.       # Include files depend on versions in current directory
  14435.       DIR=c:\include
  14436.       $(DIR)\globals.h : globals.h
  14437.            COPY globals.h $@
  14438.       $(DIR)\types.h : types.h
  14439.            COPY types.h $@
  14440.       $(DIR)\macros.h : macros.h
  14441.            COPY macros.h $@
  14442.  
  14443.  This example shows the use of NMAKE to update a group of include files. In
  14444.  the description file above, each of the files globals.h, types.h, and
  14445.  macros.h in the directory c:\include depends on its counterpart in the
  14446.  current directory. If one of the include files is out of date, NMAKE
  14447.  replaces it with the file of the same name from the current directory.
  14448.  
  14449.  The description file below, which uses the special macro $$@, is equivalent.
  14450.  
  14451.       # Include files depend on versions in current directory
  14452.       DIR=c:\include
  14453.       $(DIR)\globals.h $(DIR)\types.h $(DIR)\macros.h: $$(@F)
  14454.            !COPY $? $@
  14455.  
  14456.  In this example, the special macro $$(@F) signifies the file name (without
  14457.  the directory) of the current target.
  14458.  
  14459.  When NMAKE executes the description, it evaluates the three targets, one at
  14460.  a time, with respect to their dependents. Thus, NMAKE first checks whether
  14461.  c:\include\globals.h is out of date compared with globals.h in the current
  14462.  directory. If so, it executes the command to copy the dependent file
  14463.  globals.h to the target. NMAKE repeats the procedure for the other two
  14464.  targets. Note that in the command line, the macro $? refers to the dependent
  14465.  for this target. The macro $@ means the full name of the target.
  14466.  
  14467.  16.3.2.3  Precedence of Macro Definitions
  14468.  
  14469.  If the same macro is defined in more than one place, the rule with the
  14470.  highest priority is used. The priority from highest to lowest is as follows:
  14471.  
  14472.    1. Definitions on the command line
  14473.  
  14474.    2. Definitions in the description file or in an include file
  14475.  
  14476.    3. Definitions by an environment variable
  14477.  
  14478.    4. Definitions in the TOOLS.INI file
  14479.  
  14480.    5. Predefined macros such as CC and AS
  14481.  
  14482.  If NMAKE is invoked with the /E option, which causes environment variables
  14483.  to override macro definitions, macros defined by environment variables take
  14484.  precedence over those defined in a description file.
  14485.  
  14486.  
  14487.  16.3.3  Inference Rules
  14488.  
  14489.  Inference rules are templates that NMAKE uses to generate files with a given
  14490.  extension. When NMAKE encounters a description block with no commands, it
  14491.  looks for an inference rule that specifies how to create the target from the
  14492.  dependent files, given the two file extensions. Similarly, if a dependent
  14493.  file does not exist, NMAKE looks for an inference rule that specifies how to
  14494.  create the dependent from another file with the same base name.
  14495.  
  14496.  The use of inference rules eliminates the need to put the same commands in
  14497.  several description blocks. For example, you can use inference rules to
  14498.  specify a single QCL command that changes any C source file (which has an
  14499.  extension of .C) to an object file (which has an extension of .OBJ).
  14500.  
  14501.  Inference rules have the following form:
  14502.  
  14503.       .fromext.toext:
  14504.              command
  14505.               «command»
  14506.               .
  14507.               .
  14508.               .
  14509.  
  14510.  In this format, command specifies one of the commands involved in converting
  14511.  a file with the extension fromext to a file with the extension toext. Using
  14512.  the earlier example of converting C source files to object files, the
  14513.  inference rule looks as follows:
  14514.  
  14515.       .C.OBJ:
  14516.          QCL -c $<;
  14517.  
  14518.  The special macro $< represents the name of a dependent that is out of date
  14519.  relative to the target.
  14520.  
  14521.  Path Specifications
  14522.  
  14523.  You can specify a single path for each of the extensions, using the
  14524.  following form:
  14525.  
  14526.       {frompath}.fromext{topath}.toext
  14527.              commands
  14528.  
  14529.  NMAKE takes the files with the fromext extension it finds in the directory
  14530.  specified by frompath and uses commands to create files with the toext
  14531.  extension in the directory specified by topath.
  14532.  
  14533.  If NMAKE finds a description block without commands, it looks for an
  14534.  inference rule that matches both extensions. NMAKE searches for inference
  14535.  rules in the following order:
  14536.  
  14537.    1. In the current description file.
  14538.  
  14539.    2. In the tools-initialization file, TOOLS.INI. NMAKE first looks for the
  14540.       TOOLS.INI file in the current working directory and then in the
  14541.       directory indicated by the INIT environment variable. If it finds the
  14542.       file, NMAKE looks for the inference rules following the line that
  14543.       begins with the tag [nmake]. This begins a section that can contain all
  14544.       default macros, .SUFFIXES lists, and inference rules.
  14545.  
  14546.  ───────────────────────────────────────────────────────────────────────────
  14547.  NOTE
  14548.     NMAKE applies an inference rule only if the base name of the file it is
  14549.     trying to create matches the base name of a file that already exists.
  14550.     In effect, this means that inference rules are useful only when there is
  14551.     a one-to-one correspondence between the files with the "from" extension
  14552.     and the files with the "to" extension. You cannot, for example, define an
  14553.     inference rule that inserts a number of modules into a library.
  14554.  ───────────────────────────────────────────────────────────────────────────
  14555.  
  14556.  Predefined Inference Rules
  14557.  
  14558.  NMAKE uses three predefined inference rules, summarized in Table 16.1. Note
  14559.  that these rules use the macro CC, which invokes the Microsoft C Optimizing
  14560.  Compiler by default. If you plan to rely on inference rules to build your
  14561.  targets, you should redefine CC to invoke the QuickC compiler, as shown in
  14562.  the list in Section 16.3.2.3.
  14563.  
  14564.  Table 16.1  Predefined Inference Rules
  14565.  
  14566.  Inference           Rule                  Command        Default Action
  14567.  
  14568.  .c.obj              $(CC) $(CFLAGS)       /c $*.c        CL /c $*.c
  14569.  .c.exe              $(CC) $(CFLAGS)       $*.c           CL $*.c
  14570.  .asm.obj            $(AS) $(AFLAGS)       $*;            masm $*;
  14571.  
  14572.  Example
  14573.  
  14574.       .OBJ.EXE:
  14575.          LINK $<;
  14576.  
  14577.       EXAMPLE1.EXE: EXAMPLE1.OBJ
  14578.  
  14579.       EXAMPLE2.EXE: EXAMPLE2.OBJ
  14580.          LINK /CO EXAMPLE2,,,LIBV3.LIB
  14581.  
  14582.  In the sample description file above, the first line defines an inference
  14583.  rule that executes the LINK command on the second line to create an
  14584.  executable file whenever a change is made in the corresponding object file.
  14585.  The file name in the inference rule is specified with the special macro $<
  14586.  so that the rule applies to any .OBJ file that has an out-of-date executable
  14587.  file.
  14588.  
  14589.  When NMAKE does not find any commands in the first description block, it
  14590.  checks for a rule that may apply and finds the rule defined on the first two
  14591.  lines of the description file. NMAKE applies the rule, replacing the $<
  14592.  macro with EXAMPLE1.OBJ when it executes the command, so that the LINK
  14593.  command becomes
  14594.  
  14595.       LINK EXAMPLE1.OBJ;
  14596.  
  14597.  NMAKE does not search for an inference rule when examining the second
  14598.  description block because a command is explicitly given.
  14599.  
  14600.  
  14601.  16.3.4  Directives
  14602.  
  14603.  Using directives, you can construct description files that are similar to
  14604.  batch files. NMAKE provides directives that specify conditional execution of
  14605.  commands, display error messages, include the contents of other files, and
  14606.  turn on or off some of NMAKE's options.
  14607.  
  14608.  Each directive begins with an exclamation point (!) in the first column of
  14609.  the description file. Spaces can be placed between the exclamation point and
  14610.  the directive keyword. The list below describes the directives.
  14611.  
  14612.  
  14613. ╓┌──────────────────────────┌────────────────────────────────────────────────╖
  14614.  Directive                           Description
  14615.  
  14616.  !IF expression                      Executes the statements between the !IF
  14617.                                      keyword and the next !ELSE or !ENDIF
  14618.  Directive                           Description
  14619.  
  14620.                                     keyword and the next !ELSE or !ENDIF
  14621.                                      directive if constantexpression
  14622.                                      evaluates to a nonzero value.
  14623.  
  14624.  !ELSE                               Executes the statements between the!ELSE
  14625.                                      and !ENDIF directives if the statements
  14626.                                      preceding the!ELSE directive were not
  14627.                                      executed.
  14628.  
  14629.  !ENDIF                              Marks the end of the !IF, !IFDEF, or
  14630.                                      !IFNDEF block of statements.
  14631.  
  14632.  !IFDEF macroname                    Executes the statements between
  14633.                                      the!IFDEF keyword and the next!ELSE or
  14634.                                      !ENDIF directive if macroname is defined
  14635.                                      in the description file. NMAKE considers
  14636.                                      a macro with a null value to be defined.
  14637.  
  14638.  !IFNDEF macroname                   Executes the statements between the
  14639.  Directive                           Description
  14640.  
  14641. !IFNDEF macroname                   Executes the statements between the
  14642.                                      !IFNDEF keyword and the next !ELSE or
  14643.                                      !ENDIF directive if macroname is not
  14644.                                      defined in the description file.
  14645.  
  14646.  !UNDEF macroname                    Marks macroname as being undefined in
  14647.                                      NMAKE's symbol table.
  14648.  
  14649.  !ERROR text                         Causes text to be printed and then stops
  14650.                                      execution.
  14651.  
  14652.  !INCLUDE filename                   Reads and evaluates the file filename
  14653.                                      before continuing with the current
  14654.                                      description file. If filename is
  14655.                                      enclosed by angle brackets (< >), NMAKE
  14656.                                      searches for the file in the directories
  14657.                                      specified by the INCLUDE macro;
  14658.                                      otherwise it looks in the current
  14659.                                      directory only. The INCLUDE macro is
  14660.  Directive                           Description
  14661.  
  14662.                                     directory only. The INCLUDE macro is
  14663.                                      initially set to the value of the
  14664.                                      INCLUDE environment variable.
  14665.  
  14666.  !CMDSWITCHES: {+|-}opt.             Turns on or off one of four NMAKE
  14667.                                      options: /D, /I, /N, and /S. If no
  14668.                                      options are specified, the options are
  14669.                                      reset to the way they were when NMAKE
  14670.                                      was started. Turn an option on by
  14671.                                      preceding it with a plus sign (+), or
  14672.                                      turn it off by preceding it with a minus
  14673.                                      sign (-). Using this directive updates
  14674.                                      the MAKEFLAGS macro.
  14675.  
  14676.  
  14677.  The constantexpression used with the !IF directive may consist of integer
  14678.  constants, string constants, or program invocations. Integer constants can
  14679.  use the C unary operators for numerical negation (-), one's complement (~),
  14680.  and logical negation (!). They may also use any of the C binary operators
  14681.  listed below:
  14682.  
  14683. ╓┌──────────────────────────┌────────────────────────────────────────────────╖
  14684.  Operator                   Description
  14685.  
  14686.  +                          Addition
  14687.  
  14688.  -                          Subtraction
  14689.  
  14690.  *                          Multiplication
  14691.  
  14692.  /                          Division
  14693.  
  14694.  %                          Modulus
  14695.  
  14696.  &                          Bitwise AND
  14697.  
  14698.  |-                         Bitwise OR
  14699.  
  14700.  ^^                         Bitwise XOR
  14701.  
  14702.  Operator                   Description
  14703.  
  14704. 
  14705.  &&                         Logical AND
  14706.  
  14707.  |-|-                       Logical OR
  14708.  
  14709.  <<                         Left shift
  14710.  
  14711.  >>                         Right shift
  14712.  
  14713.  ==                         Equality
  14714.  
  14715.  !=                         Inequality
  14716.  
  14717.  <                          Less than
  14718.  
  14719.  >                          Greater than
  14720.  
  14721.  <=                         Less than or equal to
  14722.  
  14723.  Operator                   Description
  14724.  
  14725. 
  14726.  >=                         Greater than or equal to
  14727.  
  14728.  
  14729.  You can use parentheses to group expressions. Values are assumed to be
  14730.  decimal values unless specified with a leading 0 (octal) or leading 0x
  14731.  (hexadecimal). Use the equality (==) operator to compare two strings for
  14732.  equality or the inequality (!=) operator to compare for inequality. Strings
  14733.  are enclosed by quotes. Program invocations must be in square brackets ([
  14734.  ]).
  14735.  
  14736.  Example
  14737.  
  14738.       !INCLUDE <infrules.txt>
  14739.       !CMDSWITCHES +D
  14740.       winner.exe:winner.obj
  14741.       !IFDEF debug
  14742.       !  IF "$(debug)"=="y"
  14743.            LINK /CO winner.obj;
  14744.       !  ELSE
  14745.            LINK winner.obj;
  14746.       !  ENDIF
  14747.       !ELSE
  14748.       !  ERROR Macro named debug is not defined.
  14749.       !ENDIF
  14750.  
  14751.  The !INCLUDE directive causes the file INFRULES.TXT to be read and evaluated
  14752.  as if it were a part of the description file. The !CMDSWITCHES directive
  14753.  turns on the /D option, which displays the dates of the files as they are
  14754.  checked. If winner.exe is out of date with respect to winner.obj, the
  14755.  !IFDEF directive checks to see if the macro debug is defined. If it is
  14756.  defined, the !IF directive checks to see if it is set to y. If it is, then
  14757.  the linker is invoked with the /CO option; otherwise it is invoked without
  14758.  it. If the debug macro is not defined, the !ERROR directive prints the
  14759.  message and NMAKE stops executing.
  14760.  
  14761.  
  14762.  16.3.5  Pseudotargets
  14763.  
  14764.  A "pseudotarget" is a target that is not a file but instead is a name that
  14765.  serves as a "handle" for building a group of files or executing a group of
  14766.  commands. In the following example, UPDATE is a pseudotarget.
  14767.  
  14768.       UPDATE: *.*
  14769.            !copy $** a:\product
  14770.  
  14771.  When NMAKE evaluates a pseudotarget, it always considers the dependents out
  14772.  of date. In the description above, NMAKE copies each of the dependent files
  14773.  to the specified drive and directory.
  14774.  
  14775.  The NMAKE utility includes four predefined pseudotargets that provide
  14776.  special rules within a description file. The list below describes these
  14777.  pseudotargets.
  14778.  
  14779. ╓┌──────────────────────────┌────────────────────────────────────────────────╖
  14780.  Pseudotarget               Action
  14781.  
  14782.  .SILENT:                   Does not display lines as they are executed. Same
  14783.                             effect as invoking NMAKE with the /S option.
  14784.  
  14785.  .IGNORE:                   Ignores exit codes returned by programs called
  14786.  Pseudotarget               Action
  14787.  
  14788. .IGNORE:                   Ignores exit codes returned by programs called
  14789.                             from the description file. Same effect as
  14790.                             invoking NMAKE with the /I option.
  14791.  
  14792.  .SUFFIXES:list             Lists file suffixes for NMAKE to try if it needs
  14793.                             to build a target file for which no dependents
  14794.                             are specified. NMAKE searches the current
  14795.                             directory for a file with the same name as the
  14796.                             target file and a suffix from the list. If NMAKE
  14797.                             finds such a file, and if an inference rule
  14798.                             applies to the file, then NMAKE treats the file
  14799.                             as a dependent of the target. The order of the
  14800.                             suffixes in the list defines the order in which
  14801.                             NMAKE searches for the files. The list is
  14802.                             predefined as follows:
  14803.  
  14804.                             .SUFFIXES: .obj .exe .c .asm
  14805.  
  14806.                             To add suffixes to the list, specify .SUFFIXES:
  14807.  Pseudotarget               Action
  14808.  
  14809.                            To add suffixes to the list, specify .SUFFIXES:
  14810.                             followed by the new suffixes. To clear the list,
  14811.                             specify .SUFFIXES:
  14812.  
  14813.  PRECIOUS: target...        Tells NMAKE not to delete target if the commands
  14814.                             that build it are quit or interrupted. Using this
  14815.                             pseudotarget overrides the NMAKE default. By
  14816.                             default, NMAKE deletes the target if it cannot be
  14817.                             sure the target was built successfully. For
  14818.                             example:
  14819.  
  14820.                             .PRECIOUS: tools.lib
  14821.                             tools.lib : a2z.obj z2a.obj
  14822.                                     .
  14823.                                     .
  14824.                                     .
  14825.  
  14826.                             If the commands (not shown here) to build
  14827.                             tools.lib are interrupted, leaving an incomplete
  14828.  Pseudotarget               Action
  14829.  
  14830.                            tools.lib are interrupted, leaving an incomplete
  14831.                             file, NMAKE does not delete the partially built
  14832.                             tools.lib because it is listed with .PRECIOUS.
  14833.  
  14834.                             Note, however, that .PRECIOUS is useful only in
  14835.                             limited circumstances. Most professional
  14836.                             development tools, including those provided by
  14837.                             Microsoft, have their own interrupt handlers and
  14838.                             "clean up" when errors occur.
  14839.  
  14840.  
  14841.  16.4  Response-File Generation
  14842.  
  14843.  At times, you may need to issue a command in the description file that has a
  14844.  list of arguments that exceeds the DOS limit of 128 characters. NMAKE can
  14845.  generate response files for use with other programs.
  14846.  
  14847.  The syntax for creating a response file is
  14848.  
  14849.       target : dependents
  14850.         command @<< «filename»
  14851.       response-file-text
  14852.       <<
  14853.  
  14854.  All of the text between the two sets of double brackets (<<) is placed in a
  14855.  response file and given the name filename. The response file can be referred
  14856.  to at a later time using filename. If filename is not given, NMAKE gives the
  14857.  file a unique name in the directory specified by the TMP environment
  14858.  variable if it is defined; otherwise it creates it in the current directory.
  14859.  Note that the at sign (@) is not part of the NMAKE syntax but is the typical
  14860.  response-file character for utilities such as LIB and LINK.
  14861.  
  14862.  Example
  14863.  
  14864.       math.lib : add.obj sub.obj mul.obj div.obj
  14865.         LIB @<<
  14866.       math.lib
  14867.       -+add.obj-+sub.obj-+mul.obj-+div.obj
  14868.       listing
  14869.       <<
  14870.  
  14871.  The above example creates a response file and uses it to invoke the
  14872.  Microsoft Library Manager LIB. The response file specifies which library to
  14873.  use, the commands to execute, and the listing file to produce. The response
  14874.  file contains the following:
  14875.  
  14876.       math.lib
  14877.       -+add.obj-+sub.obj-+mul.obj-+div.obj
  14878.       listing
  14879.  
  14880.  
  14881.  16.5  Differences between NMAKE and MAKE
  14882.  
  14883.  NMAKE differs from MAKE in the following ways:
  14884.  
  14885.    ■  It accepts command-line arguments from a file.
  14886.  
  14887.    ■  It provides more command-line options.
  14888.  
  14889.    ■  It no longer evaluates targets sequentially. Instead, it updates the
  14890.       targets you specify when you invoke NMAKE, regardless of their
  14891.       positions in the description file. If no targets are specified, NMAKE
  14892.       updates the first target in the file.
  14893.  
  14894.    ■  It provides more special macros.
  14895.  
  14896.    ■  It permits substitutions within macros.
  14897.  
  14898.    ■  It supports directives placed in the description file.
  14899.  
  14900.    ■  It allows you to specify include files in the description file.
  14901.  
  14902.  MAKE assumed that all targets in the description file would be built.
  14903.  Because NMAKE builds the first target in the file unless you specify
  14904.  otherwise, you may need to change your old description files to work with
  14905.  the new utility.
  14906.  
  14907.  Description files written for use with MAKE typically list a series of
  14908.  subordinate targets followed by a higher-level target that depends on the
  14909.  subordinates. As MAKE executed, it would build the targets sequentially,
  14910.  creating the highest-level target at the end.
  14911.  
  14912.  The easiest way to convert these description files is to create a new
  14913.  description block at the top of the file. Give this block a pseudotarget
  14914.  named ALL and set its dependents to all of the other targets in the file.
  14915.  When NMAKE executes the description, it will assume you want to build the
  14916.  target ALL and consequently will build all targets in the file.
  14917.  
  14918.  Alternatively, if your description file already contains a block that builds
  14919.  a single, top-level target, you can simply make that block the first in the
  14920.  file.
  14921.  
  14922.  Example
  14923.  
  14924.       one.obj: one.c
  14925.  
  14926.       two.obj: two.c
  14927.  
  14928.       three.obj: three.c
  14929.  
  14930.       prog1.exe: one.obj two.obj three.obj
  14931.            link one two three, prog1;
  14932.  
  14933.       x.obj: x.c
  14934.  
  14935.       y.obj: y.c
  14936.  
  14937.       z.obj: z.c
  14938.  
  14939.       xyz.exe: x.obj y.obj z.obj
  14940.            link x y z, xyz;
  14941.  
  14942.  Assume the above is an old MAKE description file named MAKEFILE. Note that
  14943.  it builds two top-level targets, prog1.exe and xyz.exe. To use this file
  14944.  with the new NMAKE, insert the following as the first line in the file:
  14945.  
  14946.       ALL : prog1.exe xyz.exe
  14947.  
  14948.  With the addition of this line, ALL becomes the first target in the file.
  14949.  Since NMAKE, by default, builds the first target, you can invoke NMAKE with
  14950.  
  14951.       NMAKE
  14952.  
  14953.  and it will build both prog1.exe and xyz.exe.
  14954.  
  14955.  
  14956.  Chapter 17  Using Other Utilities
  14957.  ───────────────────────────────────────────────────────────────────────────
  14958.  
  14959.  The following utilities allow you to modify files and change the operating
  14960.  environment:
  14961.  
  14962.    ■  Microsoft EXE File Header Utility (EXEMOD)
  14963.  
  14964.       Modifies header information in executable files.
  14965.  
  14966.    ■  Microsoft Environment Expansion Utility (SETENV)
  14967.  
  14968.       Enlarges the DOS environment table in IBM PC-DOS Versions 2.0, 2.1,
  14969.       3.0, and 3.1. SETENV allows you to use more, larger environment
  14970.       variables.
  14971.  
  14972.    ■  Microsoft Debug Information Compactor Utility (CVPACK)
  14973.  
  14974.       Compresses executable files by reducing the size of CodeView debugging
  14975.       information within the files.
  14976.  
  14977.  The following sections explain how to use the  EXEMOD, SETENV, and CVPACK
  14978.  utilities.
  14979.  
  14980.  
  14981.  17.1  Modifying Program Headers with the EXEMOD Utility
  14982.  
  14983.  The EXEMOD utility allows you to modify fields in the header of an
  14984.  executable file. Some of the options available with EXEMOD are the same as
  14985.  LINK options, except that they work on files that have already been linked.
  14986.  Unlike the LINK options, the EXEMOD options require that values be specified
  14987.  as hexadecimal numbers.
  14988.  
  14989.  To display the current status of the header fields, type the following:
  14990.  
  14991.       EXEMOD executablefile
  14992.  
  14993.  To modify one or more of the fields in the file header, type the following:
  14994.  
  14995.       EXEMOD executablefile «options»
  14996.  
  14997.  EXEMOD expects executablefile to be the name of an existing file with the
  14998.  .EXE extension. If the file name is given without an extension, EXEMOD
  14999.  appends .EXE and searches for that file. If you supply a file with an
  15000.  extension other than .EXE, EXEMOD displays the following error message:
  15001.  
  15002.       exemod: file not .EXE
  15003.  
  15004.  The EXEMOD options are shown with the forward slash (/) designator, but a
  15005.  dash (-) may also be used. Options can be given in either uppercase or
  15006.  lowercase, but they cannot be abbreviated. The EXEMOD options and their
  15007.  effects are described in the following list:
  15008.  
  15009. ╓┌───────────────────────────┌───────────────────────────────────────────────╖
  15010.  Option                      Effect
  15011.  
  15012.  /H                          Displays the current status of the DOS program
  15013.                              header. Its effect is the same as entering
  15014.                              EXEMOD with an executablefile specification but
  15015.                              without options. The /H option should not be
  15016.                              used with other options.
  15017.  Option                      Effect
  15018.  
  15019.                             used with other options.
  15020.  
  15021.  /STACK hexnum               Allows you to set the size of the stack (in
  15022.                              bytes) for your program by setting the initial
  15023.                              SP (stack pointer) value to hexnum. The minimum
  15024.                              allocation value is adjusted upward, if
  15025.                              necessary. This option has the same effect as
  15026.                              the LINK /STACK option, except it works on files
  15027.                              that are already linked.
  15028.  
  15029.  /MIN hexnum                 Sets the minimum allocation value (that is, the
  15030.                              minimum number of 16-byte paragraphs needed by
  15031.                              the program when it is loaded into memory) to
  15032.                              hexnum. The actual value set may be different
  15033.                              from the requested value if adjustments are
  15034.                              necessary to accommodate the stack.
  15035.  
  15036.  /MAX hexnum                 Sets the maximum allocation value (that is, the
  15037.                              maximum number of 16-byte paragraphs used by the
  15038.  Option                      Effect
  15039.  
  15040.                             maximum number of 16-byte paragraphs used by the
  15041.                              program when it is loaded into memory) to
  15042.                              hexnum. The maximum allocation value must be
  15043.                              greater than or equal to the minimum allocation
  15044.                              value. This option has the same effect as the
  15045.                              LINK /CPARMAXALLOC option.
  15046.  
  15047.  
  15048.  For each of the options listed above, hexnum is a number entered using
  15049.  hexadecimal digits (uppercase or lowercase); no prefix is needed.
  15050.  
  15051.  ───────────────────────────────────────────────────────────────────────────
  15052.  NOTE
  15053.     Use of the /STACK option on programs developed with other than Microsoft
  15054.     compilers or assemblers may cause the programs to fail, or EXEMOD may
  15055.     return an error message.
  15056.  ───────────────────────────────────────────────────────────────────────────
  15057.  
  15058.  EXEMOD works on packed files. When it recognizes a packed file, it prints
  15059.  the message
  15060.  
  15061.       packed file
  15062.  
  15063.  then continues to modify the file header.
  15064.  
  15065.  When packed files are loaded, they are expanded to their unpacked state in
  15066.  memory. If the EXEMOD /STACK option is used on a packed file, the value
  15067.  changed is the value that SP has after expansion. If either the /MIN or the
  15068.  /STACK option is used, the value is corrected as necessary to accommodate
  15069.  unpacking of the modified stack. The /MAX option operates as it would for
  15070.  unpacked files.
  15071.  
  15072.  If the header of a packed file is displayed, the CS:IP and SS:SP values are
  15073.  displayed as they are after expansion. These values are not the same as the
  15074.  actual values in the header of the packed file.
  15075.  
  15076.  Example
  15077.  
  15078.       Microsoft (R) EXE File Header Utility  Version 4.02
  15079.       Copyright (C) Microsoft Corp 1985.  All rights reserved.
  15080.  
  15081.       TEST.EXE                           (hex)           (dec)
  15082.  
  15083.       .EXE size (bytes)                   439D           17309
  15084.       Minimum load size (bytes)           419D           16797
  15085.       Overlay number                         0               0
  15086.       Initial CS:IP                  0403:0000
  15087.       Initial SS:SP                  0000:0000               0
  15088.       Minimum allocation (para)              0               0
  15089.       Maximum allocation (para)           FFFF           65535
  15090.       Header size (para)                    20              32
  15091.       Relocation table offset               1E              30
  15092.       Relocation entries                     1               1
  15093.  
  15094.  The display above shows how EXEMOD would display the current file header for
  15095.  file TEST.EXE. Note that (para) refers to paragraphs, which are units of 16
  15096.  bytes. To translate paragraphs to bytes, multiply by 16. The meaning of each
  15097.  field is given below.
  15098.  
  15099.  .EXE size is the size of the file as stored on disk. Minimum load size is
  15100.  the total amount of memory that DOS must provide in order for the program to
  15101.  execute.
  15102.  
  15103.  Overlay number is the ordinal number of the overlay as generated by LINK.
  15104.  (If the executable file does not use overlays, there is exactly one overlay
  15105.  module, the root.) Since EXEMOD looks only at the beginning of the file, the
  15106.  overlay number displayed is normally 0.
  15107.  
  15108.  Initial CS:IP and Initial SS:SP indicate the initial values of the
  15109.  instruction pointer and the stack pointer, respectively. The values of CS
  15110.  and SS are relative to the beginning of the load module and are changed once
  15111.  the file is actually loaded into memory. The offset address of the stack
  15112.  pointer (SP) indicates the amount of room available for the stack to grow
  15113.  downward before reaching SS. (Some of this room may be needed by other
  15114.  segments, however.) The initial value of SP can be changed with EXEMOD.
  15115.  
  15116.  Minimum allocation indicates the amount of memory that the file requires, in
  15117.  addition to the memory that DOS uses to load the file itself. If DOS is
  15118.  unable to allocate this amount of memory, it does not execute the file. This
  15119.  value can be changed with EXEMOD.
  15120.  
  15121.  Maximum allocation indicates the amount of memory the file requests, in
  15122.  addition to memory used to load the file itself. If the amount specified is
  15123.  not available, DOS allocates all available memory. This value can be changed
  15124.  with EXEMOD.
  15125.  
  15126.  Header size gives the size of all header information, including relocation
  15127.  entries.
  15128.  
  15129.  Relocation table offset indicates the number of bytes from the beginning of
  15130.  the file to the relocation entries.
  15131.  
  15132.  Relocation entries gives the number of relocation entries. Each of these
  15133.  entries is a piece of information used to adjust segment addresses in the
  15134.  load module (the portion of the file that is actually loaded into memory).
  15135.  DOS adds the load address to each segment address so that the segment
  15136.  address refers to a true location in physical memory.
  15137.  
  15138.  Examples
  15139.  
  15140.       >EXEMOD TEST.EXE
  15141.  
  15142.  The command in the above example generates the display in the previous
  15143.  example for the file TEST.EXE.
  15144.  
  15145.       EXEMOD TEST.EXE /STACK FF /MIN FF /MAX FFF
  15146.  
  15147.  The example above uses the EXEMOD command line to modify the header fields
  15148.  in TEST.EXE.
  15149.  
  15150.       >EXEMOD TEST.EXE
  15151.  
  15152.       Microsoft (R) EXE File Header Utility  Version 4.02
  15153.       Copyright (C) Microsoft Corp 1985.  All rights reserved.
  15154.  
  15155.       TEST.EXE                           (hex)           (dec)
  15156.  
  15157.       .EXE size (bytes)                   439D           17309
  15158.       Minimum load size (bytes)           528D           20877
  15159.       Overlay number                         0               0
  15160.       Initial CS:IP                  0403:0000
  15161.       Initial SS:SP                  0000:00FF             256
  15162.       Minimum allocation (para)             FF             256
  15163.       Maximum allocation (para)            FFF            4095
  15164.       Header size (para)                    20              32
  15165.       Relocation table offset               1E              30
  15166.       Relocation entries                     1               1
  15167.  
  15168.  The last example shows the current status of the header for TEST.EXE after
  15169.  being altered by the previous example.
  15170.  
  15171.  
  15172.  17.2  Enlarging the DOS Environment with the SETENV Utility
  15173.  
  15174.  The SETENV utility allows you to allocate more operating-environment space
  15175.  to DOS by modifying a copy of COMMAND.COM.
  15176.  
  15177.  Normally, DOS Versions 2.0 and later allocate 160 bytes (10 paragraphs) for
  15178.  the environment table. This may not be enough space if you want to set
  15179.  numerous environment variables using the SET or PATH command. For example,
  15180.  if you have a hard disk with several levels of subdirectories, a single
  15181.  environment variable might take 40 or 50 characters. Since each character
  15182.  uses 1 byte, you could easily require more than 160 bytes if you want to set
  15183.  several environment variables.
  15184.  
  15185.  ───────────────────────────────────────────────────────────────────────────
  15186.  NOTE
  15187.     SETENV works with most MS-DOS and PC-DOS operating systems, Versions 2.0
  15188.     through 3.1. If the SETENV utility does not work with your version of
  15189.     COMMAND.COM, please contact Microsoft Technical Support.
  15190.  
  15191.     If you use DOS 3.2 or later, you can set the environment space with the
  15192.     DOS SHELL command. For example, the following command sets the
  15193.     environment size at 3000 bytes when placed in CONFIG.SYS:
  15194.  
  15195.         SHELL = COMMAND.COM /E:3000 /P
  15196.  
  15197.     See your DOS manual for further information.
  15198.  ───────────────────────────────────────────────────────────────────────────
  15199.  
  15200.  To enlarge the environment table, you can modify a copy of COMMAND.COM using
  15201.  SETENV. Make sure you work on a copy, and retain an unmodified version of
  15202.  COMMAND.COM for backup.
  15203.  
  15204.  The command line for modifying the environment table is as follows:
  15205.  
  15206.       SETENV filename «environmentsize»
  15207.  
  15208.  Normally, filename specifies COMMAND.COM. It must be a valid, unmodified
  15209.  copy of COMMAND.COM, though it can be renamed. The optional environmentsize
  15210.  is a decimal number specifying the size in bytes of the new allocation;
  15211.  environmentsize must be a number greater than or equal to 160 and less than
  15212.  or equal to 65,520. The specified environmentsize is rounded up to the
  15213.  nearest multiple of 16 (the size of a paragraph).
  15214.  
  15215.  If environmentsize is not given, SETENV reports the value currently
  15216.  allocated by the COMMAND.COM file.
  15217.  
  15218.  After modifying COMMAND.COM, you must reboot so that the environment table
  15219.  is set to the new size.
  15220.  
  15221.  Examples
  15222.  
  15223.       >SETENV COMMAND.COM
  15224.  
  15225.       Microsoft (R) Environment Expansion Utility  Version 2.10
  15226.       Copyright (C) Microsoft Corp 1985,1986.  All rights reserved.
  15227.  
  15228.       command.com: Environment allocation = 160
  15229.  
  15230.  In the example above, no environment size is specified, so SETENV reports
  15231.  the current size of the environment table.
  15232.  
  15233.       >SETENV COMMAND.COM 605
  15234.  
  15235.  In the example above, an environment size of 605 bytes is requested. Since
  15236.  605 bytes is not on a paragraph boundary (a multiple of 16), SETENV rounds
  15237.  the request up to 608 bytes. COMMAND.COM is modified so that it
  15238.  automatically sets an environment table of 608 bytes (38 paragraphs). You
  15239.  must reboot to set the new environment-table size.
  15240.  
  15241.  
  15242.  17.3  Saving Memory with the CVPACK Utility
  15243.  
  15244.  After you compile and link a program with CodeView debugging information,
  15245.  you can use the Microsoft Debug Information Compactor Utility (CVPACK) to
  15246.  reduce the size of the executable file. CVPACK compresses information in the
  15247.  file, and allows the CodeView debugger to load larger programs without
  15248.  running out of memory.
  15249.  
  15250.  The CVPACK utility has the following command line:
  15251.  
  15252.       CVPACK «/p» exefile
  15253.  
  15254.  The /p option results in the most effective possible packing but causes
  15255.  CVPACK to take longer to execute. When the /p option is specified, unused
  15256.  debugging information is discarded, and the packed information is sorted
  15257.  within the file. When the /p option is not specified, packed information is
  15258.  simply appended to the end of the file.
  15259.  
  15260.  To debug a file that has been altered with CVPACK, you must use Version 2.10
  15261.  or later of the CodeView debugger.
  15262.  
  15263.  
  15264.  Chapter 18  Linking for Windows and OS/2 Systems
  15265.  ───────────────────────────────────────────────────────────────────────────
  15266.  
  15267.  This chapter covers concepts important to linking for Windows and OS/2
  15268.  systems, such as dynamic-linking and import libraries. Section 18.6
  15269.  describes the IMPLIB utility for creating import libraries.
  15270.  
  15271.  In most respects, linking a program using the Microsoft Segmented-Executable
  15272.  Linker (LINK) for the OS/2 environment is similar to linking a program for
  15273.  the DOS 3.x environment. The principal difference is that most programs
  15274.  created for the DOS 3.x environment run as stand-alone applications, whereas
  15275.  programs that run under OS/2 protected mode generally call one or more
  15276.  "dynamic-link libraries."
  15277.  
  15278.  
  15279.  18.1  Dynamic-Link Libraries
  15280.  
  15281.  A dynamic-link library contains executable code for common functions, just
  15282.  as an ordinary library does. Yet code for dynamic-link functions is not
  15283.  linked into the executable (.EXE) file. Instead, the library itself is
  15284.  loaded into memory at run time, along with the .EXE file.
  15285.  
  15286.  Each .DLL file (dynamic-link library) must use "export definitions" to make
  15287.  its functions directly available to other modules. At run time, functions
  15288.  not exported can only be called from within the same file. Each export
  15289.  definition specifies a function name.
  15290.  
  15291.  Conversely, the .EXE file must use "import definitions" that tell where each
  15292.  dynamic-link function can be found. Otherwise, OS/2 would not know what
  15293.  dynamic-link libraries to load when the program is run. Each import
  15294.  definition specifies a function name and the .DLL file where the function
  15295.  resides.
  15296.  
  15297.  Assume the simplest case, in which you create one application and one
  15298.  dynamic-link library. The linker requires export and import definitions for
  15299.  dynamic-link function calls. The OS/2 operating system provides two ways for
  15300.  you to supply these definitions:
  15301.  
  15302.    ■  You create one module-definition file (.DEF extension) with export
  15303.       definitions for the .DLL file and another module-definition file with
  15304.       import definitions for the .EXE file. The module-definition files
  15305.       provide these definitions in an ASCII format.
  15306.  
  15307.    ■  You create one module-definition file (.DEF extension) for the .DLL
  15308.       file and then generate an import library to be linked to the .EXE file.
  15309.  
  15310.  The next two sections consider each of these methods in turn. Chapter 19,
  15311.  "Using Module-Definition Files," gives a complete description of
  15312.  module-definition files.
  15313.  
  15314.  
  15315.  18.2  Linking without an Import Library
  15316.  
  15317.  Figure 18.1 illustrates the first way to supply definitions for dynamic-link
  15318.  function calls, in which each of the two files──the .DLL file and the .EXE
  15319.  file──has a corresponding module-definition file. (A module-definition file
  15320.  has a .DEF default extension.)
  15321.  
  15322.  The two major steps are described below.
  15323.  
  15324.    1. Object files (and possibly standard-library files) are linked together
  15325.       with a module-definition file to create a dynamic-link library. A
  15326.       module-definition file for a dynamic-link library has at least two
  15327.       statements. The first is a LIBRARY statement, which directs the linker
  15328.       to create a .DLL rather than an .EXE file. The second statement is a
  15329.       list of export definitions.
  15330.  
  15331.    2. Object files (and possibly standard-library files) are linked together
  15332.       with a module-definition file to create an application. The
  15333.       module-definition file for this application contains a list of import
  15334.       definitions. Each definition in this list contains both a function name
  15335.       and the name of a dynamic-link library.
  15336.  
  15337.  
  15338.  18.3  Linking with an Import Library
  15339.  
  15340.  Figure 18.2 illustrates the second way to supply definitions for
  15341.  dynamic-link function calls, in which a module-definition file is supplied
  15342.  for the dynamic-link library and an import library is supplied for the
  15343.  application.
  15344.  
  15345.  The three major steps are explained below.
  15346.  
  15347.    1. Object files are linked to produce a .DLL file. This step is identical
  15348.       to the first step in the section above. Note that the module-definition
  15349.       file contains export definitions.
  15350.  
  15351.    2. The IMPLIB utility is used to generate an import library. IMPLIB takes
  15352.       as input the same module-definition file used in the first step. IMPLIB
  15353.       knows the name of the library module (which by default has the same
  15354.       base name as the .DEF file), and it determines the name of each
  15355.       exported function by examining export definitions. For each export
  15356.       definition in the .DEF file, IMPLIB generates a corresponding import
  15357.       definition.
  15358.  
  15359.    3. The .LIB file generated by IMPLIB is used as input to LINK, which
  15360.       creates an application. This .LIB file does not use the same file
  15361.       format as a .DEF file, but it fulfills the same purpose: to provide the
  15362.       linker with information about imported dynamic-link functions.
  15363.  
  15364.  The .LIB file generated by IMPLIB is called an import library. Import
  15365.  libraries are similar in most respects to ordinary libraries; you specify
  15366.  import libraries and ordinary libraries in the same command-line field of
  15367.  LINK, and you can append the two kinds of libraries together (by using the
  15368.  Library Manager). Furthermore, both kinds of libraries resolve external
  15369.  references at link time. The only difference is import libraries do not
  15370.  contain executable code, merely records that describe where the executable
  15371.  code can be found at run time.
  15372.  
  15373.  The cases considered in this section have been simple ones. Dynamic linking
  15374.  is flexible and supports more complicated cases. An application can make
  15375.  calls to more than one dynamic-link library. Furthermore, module-definition
  15376.  files for libraries can import functions as well as export them. It is
  15377.  possible for a .DLL file to call another .DLL file, and so on, to any level
  15378.  of complexity; the result may be a situation in which many files are loaded
  15379.  at run time.
  15380.  
  15381.  
  15382.  18.4  Why Use Import Libraries?
  15383.  
  15384.  At first glance, it may seem easier to create programs without import
  15385.  libraries since import libraries add an extra step to the linking process.
  15386.  However, it is easier to use import libraries for two reasons.
  15387.  
  15388.  First, the IMPLIB utility automates much of the program-creation process for
  15389.  you. To run IMPLIB, you specify the .DEF file that you already created for
  15390.  the dynamic-link library. Operation of IMPLIB is simple. If you do not use
  15391.  an import library generated by IMPLIB, you must use an ASCII text editor to
  15392.  create a second .DEF file where you explicitly give all needed import
  15393.  definitions.
  15394.  
  15395.  Second, the first two steps in the linking process described above (creation
  15396.  of the .DLL file and creation of the import library) may be carried out only
  15397.  by the author of the dynamic-link library. The libraries may then be given
  15398.  to an applications programmer, who focuses on linking the application (third
  15399.  step). An applications programmer's task is simplified by linking with the
  15400.  import library because then it is not necessary to edit the .DEF file. The
  15401.  import library comes ready to link.
  15402.  
  15403.  A good example of a useful import library is the file DOSCALLS.LIB.
  15404.  Generally, protected-mode applications need to call one of the dynamic-link
  15405.  system libraries released with OS/2; the DOSCALLS.LIB file contains import
  15406.  definitions for all calls to these system libraries. It is much easier to
  15407.  link with DOSCALLS.LIB than to create a .DEF file for every OS/2 program you
  15408.  link.
  15409.  
  15410.  
  15411.  18.5  Advantages of Dynamic Linking
  15412.  
  15413.  Why use dynamic-link libraries at all? Dynamic-link libraries serve much the
  15414.  same purpose that standard libraries do but they also give you the following
  15415.  advantages:
  15416.  
  15417.    1. Link applications faster.
  15418.  
  15419.       With dynamic linking, the executable code for a dynamic-link function
  15420.       is not copied into the application's .EXE file. Instead, only an import
  15421.       definition is copied.
  15422.  
  15423.    2. Save significant disk space.
  15424.  
  15425.       Suppose you create a library function called printit, and this function
  15426.       is called by many different programs. If printit is in a standard
  15427.       library, the function's executable code must be linked into each .EXE
  15428.       file that calls the function. In other words, the same code resides on
  15429.       your disk in many different files. But if printit is stored in a
  15430.       dynamic-link library, the executable code resides in just one file──the
  15431.       library itself.
  15432.  
  15433.    3. Make libraries and applications more independent.
  15434.  
  15435.       Dynamic-link libraries can be updated any number of times without
  15436.       relinking the applications that use them. If you are a user of
  15437.       third-party libraries, this is particularly convenient. You receive the
  15438.       updated .DLL file from the third-party developers, and you need only
  15439.       copy the new library onto your disk. At run time, your applications
  15440.       automatically call the updated library functions.
  15441.  
  15442.    4. Utilize shared code and data segments.
  15443.  
  15444.       Code and data segments loaded in from a dynamic-link library can be
  15445.       shared. Without dynamic linking, this sharing is not possible because
  15446.       each file has its own copy of all the code and data it uses. By sharing
  15447.       segments with dynamic linking, you can use memory more efficiently.
  15448.  
  15449.  
  15450.  18.6  Creating Import Libraries with IMPLIB
  15451.  
  15452.  This section summarizes the use of the Microsoft Import Library Manager
  15453.  (IMPLIB), and assumes you are familiar with the concepts of import
  15454.  libraries, dynamic linking, and module-definition files discussed in Section
  15455.  18.2.
  15456.  
  15457.  
  15458.  You can create an import library for use by other programmers in resolving
  15459.  external references to your dynamic-link library. The IMPLIB command creates
  15460.  an import library, which is a file with a .LIB extension that can be read by
  15461.  the OS/2 linker. The .LIB file can be specified in the LINK command line
  15462.  with other libraries. Import libraries are recommended for all dynamic-link
  15463.  libraries. Without the use of import libraries, external references to
  15464.  dynamic-link routines must be declared in an IMPORTS statement in the
  15465.  module-definition file for the application being linked. IMPLIB is supported
  15466.  only in protected mode.
  15467.  
  15468.  The IMPLIB command-line format is as follows:
  15469.  
  15470.       IMPLIB implibname mod-def-file «mod-def-file...»
  15471.  
  15472.  The implibname is the name you wish the new import library to have.
  15473.  
  15474.  The mod-def-file is the name of a module-definition file for the
  15475.  dynamic-link module. You may enter more than one.
  15476.  
  15477.  Example
  15478.  
  15479.  The following command creates the import library named MYLIB.LIB from the
  15480.  module-definition file MYLIB.DEF:
  15481.  
  15482.       IMPLIB mylib.lib mylib.def
  15483.  
  15484.  
  15485.  Chapter 19  Using Module-Definition Files
  15486.  ───────────────────────────────────────────────────────────────────────────
  15487.  
  15488.  A module-definition file describes the name, attributes, exports, imports,
  15489.  and other characteristics of an application or library for OS/2 or Microsoft
  15490.  Windows. This file is required for Windows applications and libraries and is
  15491.  also required for dynamic-link libraries that run under OS/2.
  15492.  
  15493.  
  15494.  19.1  Module Statements
  15495.  
  15496.  A module-definition file contains one or more "module statements." Each
  15497.  module statement defines an attribute of the executable file, such as its
  15498.  module name, the attributes of program segments, and the number and names of
  15499.  exported and imported functions. The module statements and the attributes
  15500.  they define are listed below.
  15501.  
  15502. ╓┌──────────────────────────┌────────────────────────────────────────────────╖
  15503.  Module Statements          Attribute Defined
  15504.  
  15505.  NAME                       Names application (no library created)
  15506.  
  15507.  LIBRARY                    Names dynamic-link library (no application
  15508.                             created)
  15509.  
  15510.  DESCRIPTION                Describes the module in one line
  15511.  
  15512.  CODE                       Gives default attributes for code segments
  15513.  
  15514.  DATA                       Gives default attributes for data segments
  15515.  
  15516.  SEGMENTS                   Gives attributes for specific segments
  15517.  
  15518.  STACKSIZE                  Specifies local-stack size in bytes
  15519.  
  15520.  EXPORTS                    Defines exported functions
  15521.  Module Statements          Attribute Defined
  15522.  
  15523. EXPORTS                    Defines exported functions
  15524.  
  15525.  IMPORTS                    Defines imported functions
  15526.  
  15527.  STUB                       Adds a DOS 3.x executable file to the beginning
  15528.                             of the module, usually to terminate the program
  15529.                             when run in real mode
  15530.  
  15531.  HEAPSIZE                   Specifies local heap size in bytes
  15532.  
  15533.  PROTMODE                   Specifies that the module runs only in DOS
  15534.                             protected mode
  15535.  
  15536.  OLD                        Preserves import information from a previous
  15537.                             version of the library
  15538.  
  15539.  REALMODE                   Relaxes some restrictions that the linker imposes
  15540.                             for protected-mode programs
  15541.  
  15542.  Module Statements          Attribute Defined
  15543.  
  15544. 
  15545.  EXETYPE                    Identifies operating system
  15546.  
  15547.  
  15548.  The following rules govern the use of module statements in a
  15549.  module-definition file:
  15550.  
  15551.    ■  If you use either a NAME or a LIBRARY statement, it must precede all
  15552.       other statements in the module-definition file.
  15553.  
  15554.    ■  You can include source-level comments in the module-definition file by
  15555.       beginning a line with a semicolon (;). The OS/2 utilities ignore each
  15556.       such comment line.
  15557.  
  15558.    ■  All module-definition keywords (such as NAME, LIBRARY, and OLD) must be
  15559.       entered in uppercase letters.
  15560.  
  15561.  The sample module-definition file below gives module definitions for a
  15562.  dynamic-link library. This sample file includes one source-level comment and
  15563.  five statements.
  15564.  
  15565.       ; Sample module-definition file
  15566.  
  15567.       LIBRARY
  15568.  
  15569.       DESCRIPTION 'Sample .DEF file for a dynamic-link library'
  15570.  
  15571.       CODE       PRELOAD
  15572.  
  15573.       STACKSIZE  1024
  15574.  
  15575.       EXPORTS
  15576.           Init   @1
  15577.           Begin  @2
  15578.           Finish @3
  15579.           Load   @4
  15580.           Print  @5
  15581.  
  15582.  The sections below explain the meaning of these statements, as well as
  15583.  others, giving syntax and examples.
  15584.  
  15585.  
  15586.  19.2  The NAME Statement
  15587.  
  15588.  The NAME statement identifies the executable file as an application and
  15589.  optionally defines the name.
  15590.  
  15591.  Syntax
  15592.  
  15593.       NAME «appname» «apptype»
  15594.  
  15595.  Remarks
  15596.  
  15597.  If appname is given, it becomes the name of the application as it is known
  15598.  by OS/2. This name can be any valid file name. If appname is not given, the
  15599.  name of the module-definition file──with the extension removed──becomes the
  15600.  name of the application.
  15601.  
  15602.  The apptype field will be used by a future version of OS/2 and should be
  15603.  declared for compatibility with this future version.
  15604.  
  15605.  If apptype is given, it defines the type of application being linked. This
  15606.  information is kept in the executable-file header. You do not need to use
  15607.  this field unless you may be using your application in a Windows
  15608.  environment. The apptype field may have one of the following values:
  15609.  
  15610.  Keyword                     Meaning
  15611.  
  15612.  WINDOWAPI                   Real-mode Presentation Manager application. The
  15613.                              application uses the API provided by the
  15614.                              Presentation Manager and must be executed in the
  15615.                              Presentation Manager environment.
  15616.  
  15617.  WINDOWCOMPAT                Presentation Manager-compatible application. The
  15618.                              application can run inside the Presentation
  15619.                              Manager, or it can run in a separate screen
  15620.                              group. An application can be of this type if it
  15621.                              uses the proper subset of OS/2 video, keyboard,
  15622.                              and mouse functions supported in the
  15623.                              Presentation Manager applications.
  15624.  
  15625.  NOTWINDOWCOMPAT             Application is not compatible with the
  15626.                              Presentation Manager and must operate in a
  15627.                              separate screen group from the Presentation
  15628.                              Manager.
  15629.  
  15630.  If the NAME statement is included in the module-definition file, the LIBRARY
  15631.  statement cannot appear. If neither a NAME statement nor a LIBRARY statement
  15632.  appears in a module-definition file, the default is NAME──that is, the
  15633.  linker acts as though a NAME statement were included, and thus creates an
  15634.  application rather than a library.
  15635.  
  15636.  Example
  15637.  
  15638.  The example below assigns the name calendar to the application being
  15639.  defined:
  15640.  
  15641.       NAME calendar WINDOWCOMPAT
  15642.  
  15643.  
  15644.  19.3  The LIBRARY Statement
  15645.  
  15646.  The LIBRARY statement identifies the executable file as a dynamic-link
  15647.  library and it can specify the name of the library or the type of
  15648.  library-module initialization required.
  15649.  
  15650.  Syntax
  15651.  
  15652.       LIBRARY «libraryname» «initialization»
  15653.  
  15654.  Remarks
  15655.  
  15656.  If libraryname is given, it becomes the name of the library as it is known
  15657.  by OS/2. This name can be any valid file name. If libraryname is not given,
  15658.  the name of the module-definition file──with the extension removed──becomes
  15659.  the name of the library.
  15660.  
  15661.  The initialization field is optional and can have one of the two values
  15662.  listed below. If neither is given, then the initialization default
  15663.  is INITGLOBAL.
  15664.  
  15665.  Keyword                     Meaning
  15666.  
  15667.  INITGLOBAL                  The library-initialization routine is called
  15668.                              only when the library module is initially loaded
  15669.                              into memory
  15670.  
  15671.  INITINSTANCE                The library-initialization routine is called
  15672.                              each time a new process gains access to the
  15673.                              library
  15674.  
  15675.  If the LIBRARY statement is included in a module-definition file, NAME
  15676.  cannot appear. If no LIBRARY statement appears in a module-definition file,
  15677.  the linker assumes that the module-definition file is defining an
  15678.  application.
  15679.  
  15680.  Example
  15681.  
  15682.  The following example assigns the name calendar to the dynamic-link module
  15683.  being defined, and specifies that library initialization is performed each
  15684.  time a new process gains access to calendar:
  15685.  
  15686.       LIBRARY calendar INITINSTANCE
  15687.  
  15688.  
  15689.  19.4  The DESCRIPTION Statement
  15690.  
  15691.  The DESCRIPTION statement inserts the specified text into the application or
  15692.  library. This statement is useful for embedding source-control or copyright
  15693.  information into an application or library.
  15694.  
  15695.  Syntax
  15696.  
  15697.      DESCRIPTION 'text'
  15698.  
  15699.  Remarks
  15700.  
  15701.  The text is a one-line string enclosed in single quotation marks. Use of the
  15702.  DESCRIPTION statement is different from the inclusion of a comment because
  15703.  comments──lines that begin with a semicolon (;)──are not placed in the
  15704.  application or library.
  15705.  
  15706.  Example
  15707.  
  15708.  The following example inserts the text Template Program into the application
  15709.  or library being defined:
  15710.  
  15711.       DESCRIPTION 'Template Program'
  15712.  
  15713.  
  15714.  19.5  The CODE Statement
  15715.  
  15716.  The CODE statement defines the default attributes for code segments within
  15717.  the application or library.
  15718.  
  15719.  Syntax
  15720.  
  15721.       CODE «attribute...»
  15722.  
  15723.  Remarks
  15724.  
  15725.  Each attribute must correspond to one of the following attribute fields.
  15726.  Each field can appear at most one time, and order is not significant. The
  15727.  attribute fields are presented below, along with legal values. In each case,
  15728.  the default value is listed last. The last three fields have no effect on
  15729.  OS/2 code segments and are included for use with Microsoft Windows.
  15730.  
  15731.  Field                       Values
  15732.  
  15733.  load                        PRELOAD, LOADONCALL
  15734.  
  15735.  executeonly                 EXECUTEONLY, EXECUTEREAD
  15736.  
  15737.  iopl                        IOPL, NOIOPL
  15738.  
  15739.  conforming                  CONFORMING, NONCONFORMING
  15740.  
  15741.  shared                      SHARED, NONSHARED
  15742.  
  15743.  movable                     MOVABLE, FIXED
  15744.  
  15745.  discard                     NONDISCARDABLE, DISCARDABLE
  15746.  
  15747.  The load field determines when a code segment is to be loaded. This field
  15748.  contains one of the following keywords:
  15749.  
  15750.  Keyword                     Meaning
  15751.  
  15752.  PRELOAD                     The segment is loaded automatically at the
  15753.                              beginning of the program
  15754.  
  15755.  LOADONCALL                  The segment is not loaded until accessed (the
  15756.                              default)
  15757.  
  15758.  The executeonly field determines whether a code segment can be read as well
  15759.  as executed. This field contains one of the following keywords:
  15760.  
  15761.  Keyword                     Meaning
  15762.  
  15763.  EXECUTEONLY                 The segment can only be executed
  15764.  
  15765.  EXECUTEREAD                 The segment can be both executed and read (the
  15766.                              default)
  15767.  
  15768.  The iopl field determines whether or not a segment has I/O privilege (that
  15769.  is, whether it can access the hardware directly). This field contains one of
  15770.  the following keywords:
  15771.  
  15772.  Keyword                     Meaning
  15773.  
  15774.  IOPL                        The code segment has I/O privilege
  15775.  
  15776.  NOIOPL                      The code segment does not have I/O privilege
  15777.                              (the default)
  15778.  
  15779.  The conforming field specifies whether a code segment is a 286 "conforming"
  15780.  segment. The concept of a conforming segment deals with privilege level (the
  15781.  range of instructions that the process can execute) and is relevant only to
  15782.  users writing device drivers and system-level code. A conforming segment can
  15783.  be called from either Ring 2 or Ring 3, and the segment executes at the
  15784.  caller's privilege level. This field contains one of the following keywords:
  15785.  
  15786.  Keyword                     Meaning
  15787.  
  15788.  CONFORMING                  The segment is conforming
  15789.  
  15790.  NONCONFORMING               The segment is nonconforming (the default)
  15791.  
  15792.  The shared field determines whether all instances of the program can share a
  15793.  given code segment. This field is ignored by OS/2, but is provided for use
  15794.  with real-mode Windows. Under OS/2, all code segments are shared. The shared
  15795.  field contains one of the following keywords: SHARED or NONSHARED (the
  15796.  default for Windows).
  15797.  
  15798.  The movable field determines whether a segment can be moved around in
  15799.  memory. This field is ignored by OS/2, but is provided for use with
  15800.  real-mode Windows. Under OS/2, all segments are movable. The movable field
  15801.  contains one of the following keywords: MOVABLE or FIXED (the default for
  15802.  Windows).
  15803.  
  15804.  The discard field determines whether a segment can be swapped out to disk by
  15805.  the operating system when not currently needed. This attribute is ignored by
  15806.  OS/2, but is provided for use with real-mode Windows. Under OS/2 systems,
  15807.  all segments can be swapped as needed. The shared attribute contains one of
  15808.  the following keywords: DISCARDABLE or NONDISCARDABLE (the default for
  15809.  Windows).
  15810.  
  15811.  Example
  15812.  
  15813.  The following example sets defaults for the module's code segments so they
  15814.  are not loaded until accessed and have I/O hardware privilege:
  15815.  
  15816.       CODE LOADONCALL IOPL
  15817.  
  15818.  
  15819.  19.6  The DATA Statement
  15820.  
  15821.  The DATA statement defines the default attributes for the data segments
  15822.  within the application or module.
  15823.  
  15824.  Syntax
  15825.  
  15826.       DATA «attribute...»
  15827.  
  15828.  Remarks
  15829.  
  15830.  Each attribute must correspond to one of the following attribute fields.
  15831.  Each field can appear at most one time, and order is not significant. The
  15832.  attribute fields are present below, along with legal values. In each case,
  15833.  the default value is listed last. The last two fields have no effect on OS/2
  15834.  data segments, but are included for use with Microsoft Windows.
  15835.  
  15836.  Field                       Values
  15837.  
  15838.  load                        PRELOAD, LOADONCALL
  15839.  
  15840.  readonly                    READONLY, READWRITE
  15841.  
  15842.  instance                    NONE, SINGLE, MULTIPLE
  15843.  
  15844.  iopl                        IOPL, NOIOPL
  15845.  
  15846.  shared                      SHARED, NONSHARED
  15847.  
  15848.  movable                     MOVABLE, FIXED
  15849.  
  15850.  discard                     NONDISCARDABLE, DISCARDABLE
  15851.  
  15852.  The load field determines when a segment will be loaded. This field contains
  15853.  one of the following keywords:
  15854.  
  15855.  Keyword                     Meaning
  15856.  
  15857.  PRELOAD                     The segment is loaded when the program begins
  15858.                              execution
  15859.  
  15860.  LOADONCALL                  The segment is not loaded until it is accessed
  15861.                              (the default)
  15862.  
  15863.  The readonly field determines the access rights to a data segment. This
  15864.  field contains one of the following keywords:
  15865.  
  15866.  Keyword                     Meaning
  15867.  
  15868.  READONLY                    The segment can only be read
  15869.  
  15870.  READWRITE                   The segment can be both read and written to (the
  15871.                              default)
  15872.  
  15873.  The instance field affects the sharing attributes of the automatic data
  15874.  segment, which is the physical segment represented by the group name DGROUP.
  15875.  (This segment group makes up the physical segment which contains the local
  15876.  stack and heap of the application.) The instance field contains one of the
  15877.  following keywords:
  15878.  
  15879.  Keyword                     Meaning
  15880.  
  15881.  NONE                        No automatic data segment is created.
  15882.  
  15883.  SINGLE                      A single automatic data segment is shared by all
  15884.                              instances of the module. In this case, the
  15885.                              module is said to have "solo" data. This keyword
  15886.                              is the default for dynamic-link libraries.
  15887.  
  15888.  MULTIPLE                    The automatic data segment is copied for each
  15889.                              instance of the module. In this case, the module
  15890.                              is said to have "instance" data. This keyword is
  15891.                              the default for applications.
  15892.  
  15893.  The iopl field determines whether or not data segments have I/O privilege
  15894.  (that is, whether or not they can access the hardware directly). This field
  15895.  contains one of the following keywords:
  15896.  
  15897.  Keyword                     Meaning
  15898.  
  15899.  IOPL                        The data segments have I/O privilege
  15900.  
  15901.  NOIOPL                      The data segments do not have I/O privilege (the
  15902.                              default)
  15903.  
  15904.  The shared field determines whether all instances of the program can share a
  15905.  READWRITE data segment. Under OS/2, this field is ignored by the linker if
  15906.  the segment has the attribute READONLY, since READONLY data segments are
  15907.  always shared. The shared field contains one of the following keywords:
  15908.  
  15909.  Keyword                     Meaning
  15910.  
  15911.  SHARED                      One copy of the data segment will be loaded and
  15912.                              shared among all processes accessing the module.
  15913.                              This keyword is the default for dynamic-link
  15914.                              libraries
  15915.  
  15916.  NONSHARED                   The segment cannot be shared and must be loaded
  15917.                              separately for each process. This keyword is the
  15918.                              default for applications
  15919.  
  15920.  The movable field determines whether a segment can be moved around in
  15921.  memory. This field is ignored by OS/2, but is provided for use with
  15922.  real-mode Windows. Under OS/2, all segments are movable. The movable field
  15923.  contains one of the following keywords: MOVABLE or FIXED (the default for
  15924.  Windows).
  15925.  
  15926.  The optional discard field determines whether a segment can be swapped out
  15927.  to disk by the operating system when not currently needed. This attribute is
  15928.  ignored by OS/2, but is provided for use with real-mode Windows. Under OS/2
  15929.  systems, all segments can be swapped as needed. The discard attribute
  15930.  contains one of the following keywords: DISCARDABLE or NONDISCARDABLE (the
  15931.  default for Windows).
  15932.  
  15933.  Note that the linker makes the automatic-data-segment attribute (specified
  15934.  by an instance value of SINGLE or MULTIPLE) match the sharing attribute of
  15935.  the automatic data segment (specified by a shared value of SHARED or
  15936.  NONSHARED). Solo data (specified by SINGLE) force shared data segments by
  15937.  default. Instance data (specified by MULTIPLE) force nonshared data by
  15938.  default. Similarly, SHARED forces solo data, and NONSHARED forces instance
  15939.  data.
  15940.  
  15941.  If you give a contradictory DATA statement such as DATA SINGLE NONSHARED,
  15942.  all segments in DGROUP are shared, and all other data segments are nonshared
  15943.  by default. If a segment that is a member of DGROUP is defined with a
  15944.  sharing attribute that conflicts with the automatic data type, a warning
  15945.  about the bad segment is issued, and the segment's flags are converted to a
  15946.  consistent sharing attribute. For example, the following
  15947.  
  15948.       DATA SINGLE
  15949.       SEGMENTS
  15950.       _DATA CLASS 'DATA' NONSHARED
  15951.  
  15952.  is converted to
  15953.  
  15954.       _DATA CLASS 'DATA' SHARED
  15955.  
  15956.  Example
  15957.  
  15958.  The example below defines the application's data segment so it is loaded
  15959.  only when it is accessed and cannot be shared by more than one copy of the
  15960.  program.
  15961.  
  15962.       DATA LOADONCALL NONSHARED
  15963.  
  15964.  By default, the data segment can be read and written, the automatic-data
  15965.  segment is copied for each instance of the module, and the data segment has
  15966.  no I/O privilege.
  15967.  
  15968.  
  15969.  19.7  The SEGMENTS Statement
  15970.  
  15971.  The SEGMENTS statement defines the attributes of one or more segments in the
  15972.  application or library on a segment-by-segment basis. The attributes
  15973.  specified by this statement override defaults set in CODE and DATA
  15974.  statements.
  15975.  
  15976.  Syntax
  15977.  
  15978.       SEGMENTS segmentdefinitions
  15979.  
  15980.  Remarks
  15981.  
  15982.  The SEGMENTS keyword marks the beginning of the segment definitions. This
  15983.  keyword can be followed by one or more segment definitions, each on a
  15984.  separate line (limited by the number set by the linker's /SEGMENTS option,
  15985.  or 128 if the option is not used). The syntax for each segment definition is
  15986.  as follows:
  15987.  
  15988.       «'»segmentname«'»«CLASS'classname'» «attribute... »
  15989.  
  15990.  Each segment definition begins with a segmentname, which can be placed in
  15991.  optional single quotation marks ('). The quotation marks are required if
  15992.  segmentname conflicts with a module-definition keyword, such as CODE or
  15993.  DATA.
  15994.  
  15995.  The CLASS keyword specifies the class of the segment. Single quotation marks
  15996.  (') are required around classname. If you do not use the CLASS argument, the
  15997.  linker assumes that the class is CODE.
  15998.  
  15999.  Each attribute must correspond to one of the following attribute fields.
  16000.  Each field can appear at most one time, and order is not significant. The
  16001.  attribute fields are presented below, along with legal values. In each case,
  16002.  the default value is listed last.
  16003.  
  16004.  Field                       Values
  16005.  
  16006.  load                        PRELOAD, LOADONCALL
  16007.  
  16008.  readonly                    READONLY, READWRITE
  16009.  
  16010.  executeonly                 EXECUTEONLY, EXECUTEREAD
  16011.  
  16012.  iopl                        IOPL, NOIOPL
  16013.  
  16014.  conforming                  CONFORMING, NONCONFORMING
  16015.  
  16016.  shared                      SHARED, NONSHARED
  16017.  
  16018.  movable                     MOVABLE, FIXED
  16019.  
  16020.  discard                     NONDISCARDABLE, DISCARDABLE
  16021.  
  16022.  The load field determines when a segment is to be loaded. This field
  16023.  contains one of the following keywords:
  16024.  
  16025.  Keyword                     Meaning
  16026.  
  16027.  PRELOAD                     The segment is loaded automatically at the
  16028.                              beginning of the program
  16029.  
  16030.  LOADONCALL                  The segment is not loaded until accessed (the
  16031.                              default)
  16032.  
  16033.  The readonly field determines the access rights to a data segment. This
  16034.  field contains one of the following keywords:
  16035.  
  16036.  Keyword                     Meaning
  16037.  
  16038.  READONLY                    The segment can only be read
  16039.  
  16040.  READWRITE                   The segment can be both read and written to (the
  16041.                              default)
  16042.  
  16043.  The executeonly field determines whether a code segment can be read as well
  16044.  as executed. (The attribute has no effect on data segments.) This field
  16045.  contains one of the following keywords:
  16046.  
  16047.  Keyword                     Meaning
  16048.  
  16049.  EXECUTEONLY                 The segment can only be executed
  16050.  
  16051.  EXECUTEREAD                 The segment can be both executed and read (the
  16052.                              default)
  16053.  
  16054.  The iopl field determines whether or not a segment has I/O privilege (that
  16055.  is, whether it can access the hardware directly). This field contains one of
  16056.  the following keywords:
  16057.  
  16058.  Keyword                     Meaning
  16059.  
  16060.  IOPL                        The segments have I/O privilege
  16061.  
  16062.  NOIOPL                      The segments do not have I/O privilege (the
  16063.                              default)
  16064.  
  16065.  The conforming field specifies whether a code segment is a 286 "conforming"
  16066.  segment. The concept of a conforming segment deals with privilege level (the
  16067.  range of instructions that the process can execute) and is relevant only to
  16068.  users writing device drivers and system-level code. A conforming segment can
  16069.  be called from either Ring 2 or Ring 3, and the segment executes at the
  16070.  caller's privilege level. (The attribute has no effect on data segments.)
  16071.  This field contains one of the following keywords:
  16072.  
  16073.  Keyword                     Meaning
  16074.  
  16075.  CONFORMING                  The segment is conforming
  16076.  
  16077.  NONCONFORMING               The segment is nonconforming (the default)
  16078.  
  16079.  The shared field determines whether all instances of the program can share a
  16080.  READWRITE segment. For code segments and READONLY data segments, this field
  16081.  is ignored by OS/2, but is provided for use with real-mode Windows. Under
  16082.  OS/2, all code segments and all READONLY data segments are shared. The
  16083.  shared field contains one of the following keywords: SHARED or NONSHARED
  16084.  (the default).
  16085.  
  16086.  The movable field determines whether a segment can be moved around in
  16087.  memory. This field is ignored by OS/2, but is provided for use with
  16088.  real-mode Windows. Under OS/2, all segments are movable. The movable field
  16089.  contains one of the following keywords: MOVABLE or FIXED (the default for
  16090.  Windows).
  16091.  
  16092.  The optional discard field determines whether a segment can be swapped out
  16093.  to disk by the operating system, when not currently needed. This attribute
  16094.  is ignored by OS/2, but is provided for use with real-mode Windows. Under
  16095.  OS/2 systems, all segments can be swapped as needed. The shared attribute
  16096.  contains one of the following keywords: DISCARDABLE or NONDISCARDABLE (the
  16097.  default for Windows).
  16098.  
  16099.  Example
  16100.  
  16101.  The following example specifies segments named cseg1, cseg2, and dseg. The
  16102.  first segment is assigned class mycode and the second is assigned CODE by
  16103.  default. Each segment is given different attributes.
  16104.  
  16105.       SEGMENTS
  16106.           cseg1 CLASS 'mycode' IOPL
  16107.           cseg2 EXECUTEONLY PRELOAD CONFORMING
  16108.           dseg  CLASS 'data' LOADONCALL READONLY
  16109.  
  16110.  
  16111.  19.8  The STACKSIZE Statement
  16112.  
  16113.  The STACKSIZE statement performs the same function as the /STACKSIZE linker
  16114.  option. It overrides the size of any stack segment defined in an
  16115.  application. (The STACKSIZE statement overrides the /STACKSIZE option).
  16116.  
  16117.  Syntax
  16118.  
  16119.       STACKSIZE number
  16120.  
  16121.  Remarks
  16122.  
  16123.  The number must be an integer; it is considered to be in decimal format by
  16124.  default, but you can use C notation to specify hexadecimal or octal.
  16125.  
  16126.  Example
  16127.  
  16128.  The following example allocates 4,096 bytes of local-stack space:
  16129.  
  16130.       STACKSIZE 4096
  16131.  
  16132.  
  16133.  19.9  The EXPORTS Statement
  16134.  
  16135.  The EXPORTS statement defines the names and attributes of the functions
  16136.  exported to other modules and of the functions that run with I/O privilege.
  16137.  The term "export" refers to the process of making a function available to
  16138.  other run-time modules. By default, functions are hidden from other modules
  16139.  at run time.
  16140.  
  16141.  Syntax
  16142.  
  16143.       EXPORTS exportdefinitions
  16144.  
  16145.  Remarks
  16146.  
  16147.  The EXPORTS keyword marks the beginning of the export definitions. It may be
  16148.  followed by up to 3,072 export definitions, each on a separate line. You
  16149.  need to give an export definition for each dynamic-link routine you want to
  16150.  make available to other modules. The syntax for an export definition is as
  16151.  follows:
  16152.  
  16153.       entryname«=internalname» «@ord«RESIDENTNAME»» «pwords» «NODATA»
  16154.  
  16155.  The entryname specification defines the function name as it is known to
  16156.  other modules. The optional internalname defines the actual name of the
  16157.  export function as it appears within the module itself; by default, this
  16158.  name is the same as entryname.
  16159.  
  16160.  The optional ord field defines the function's ordinal position within the
  16161.  module-definition table. If this field is used, the function's entry point
  16162.  can be invoked by name or by ordinal. Use of ordinal positions is faster and
  16163.  may save space.
  16164.  
  16165.  The optional keyword RESIDENTNAME specifies that the function's name be kept
  16166.  resident in memory at all times. This keyword is applicable only if the ord
  16167.  option is used because if the ord option is not used, OS/2 automatically
  16168.  keeps the names of all exported functions resident in memory anyway.
  16169.  
  16170.  The pwords field specifies the total size of the function's parameters, as
  16171.  meas-ured in words (the total number of bytes divided by two). This field is
  16172.  required only if the function executes with I/O privilege. When a function
  16173.  with I/O privilege is called, OS/2 consults the pwords field to determine
  16174.  how many words to copy from the caller's stack to the I/O-privileged
  16175.  function's stack.
  16176.  
  16177.  The optional keyword NODATA is ignored by OS/2, but is provided for use by
  16178.  real-mode Windows.
  16179.  
  16180.  Normally, the EXPORTS statement is only meaningful for functions within
  16181.  dynamic-link libraries and for functions that execute with I/O privilege.
  16182.  
  16183.  Example
  16184.  
  16185.  The following EXPORTS statement defines the three export functions
  16186.  SampleRead, StringIn, and CharTest. The first two functions can be accessed
  16187.  either by their exported names or by an ordinal number. Note that in the
  16188.  module's own source code, these functions are defined as read2bin and str1,
  16189.  respectively. The last function runs with I/O privilege and therefore is
  16190.  given with the total size of the parameters: six words.
  16191.  
  16192.       EXPORTS
  16193.              SampleRead = read2bin  @8
  16194.              StringIn = str1        @4  RESIDENTNAME
  16195.              CharTest   6
  16196.  
  16197.  
  16198.  19.10  The IMPORTS Statement
  16199.  
  16200.  The IMPORTS statement defines the names of the functions that will be
  16201.  imported for the application or library. The term "import" refers to the
  16202.  process of declaring that a symbol is defined in another run-time module (a
  16203.  dynamic-link library). Typically, LINK uses an import library (created by
  16204.  the IMPLIB utility) to resolve external references to dynamic-link symbols.
  16205.  However, the IMPORTS statement provides an alternative for resolving these
  16206.  references within a module.
  16207.  
  16208.  Syntax
  16209.  
  16210.       IMPORTS importdefinitions
  16211.  
  16212.  Remarks
  16213.  
  16214.  The IMPORTS keyword marks the beginning of the import definitions. This
  16215.  keyword is followed by one or more import definitions, each on a separate
  16216.  line. The only limit on the number of import definitions is that the total
  16217.  amount of space required for their names must be less than 64K. Each import
  16218.  definition corresponds to a particular function. The syntax for an import
  16219.  definition is as follows:
  16220.  
  16221.       «internalname=»modulename.entry
  16222.  
  16223.  The internalname specifies the name that the importing module actually uses
  16224.  to call the function. Thus, internalname appears in the source code of the
  16225.  importing module, though the function may have a different name in the
  16226.  module where it is defined. By default, internalname is the same as the name
  16227.  given in entry.
  16228.  
  16229.  The modulename is the name of the application or library that contains the
  16230.  function.
  16231.  
  16232.  The entry field determines the function to be imported and can be a name or
  16233.  an ordinal value. (Ordinal values are set in an EXPORTS statement.) If an
  16234.  ordinal value is given, the internalname field is required.
  16235.  
  16236.  ───────────────────────────────────────────────────────────────────────────
  16237.  NOTE
  16238.     A given function has a name for each of three different contexts. The
  16239.     function has a name used by the exporting module (where it is defined), a
  16240.     name used as an entry point between modules, and a name as it is used by
  16241.     the importing module (where it is called). If neither module uses the
  16242.     optional internalname field, the function has the same name in all three
  16243.     contexts. If either of the modules use the internalname field, the
  16244.     function may have more than one distinct name.
  16245.  ───────────────────────────────────────────────────────────────────────────
  16246.  
  16247.  Example
  16248.  
  16249.  The following IMPORTS statement defines three functions to be imported:
  16250.  SampleRead, SampleWrite, and a function that has been assigned an ordinal
  16251.  value of 1. The functions are found in the modules Sample, SampleA, and
  16252.  Read, respectively. The function from the Read module is referred to as
  16253.  ReadChar in the importing module; the original name of the function, as it
  16254.  is defined in the Read module, may or may not be known.
  16255.  
  16256.       IMPORTS
  16257.           Sample.SampleRead
  16258.           SampleA.SampleWrite
  16259.           ReadChar = Read.1
  16260.  
  16261.  
  16262.  19.11  The STUB Statement
  16263.  
  16264.  The STUB statement adds a DOS 3.x executable file to the beginning of the
  16265.  application or library being created. The stub is invoked whenever the
  16266.  module is executed under DOS 2.x or DOS 3.x. Typically, the stub displays a
  16267.  message and terminates execution. (By default, the linker adds its own
  16268.  standard stub for this purpose.)
  16269.  
  16270.  Syntax
  16271.  
  16272.       STUB 'filename'
  16273.  
  16274.  Remarks
  16275.  
  16276.  The filename specifies the DOS executable file to be added. If the linker
  16277.  does not find filename in the current directory, it searches in the list of
  16278.  directories specified in the PATH environment variable.
  16279.  
  16280.  Example
  16281.  
  16282.  The following example appends the DOS executable file STOPIT.EXE to the
  16283.  beginning of the module:
  16284.  
  16285.       STUB 'STOPIT.EXE'
  16286.  
  16287.  The file STOPIT.EXE is executed when you attempt to run the module under
  16288.  DOS.
  16289.  
  16290.  
  16291.  19.12  The HEAPSIZE Statement
  16292.  
  16293.  The HEAPSIZE statement defines the size of the application's local heap in
  16294.  bytes. This value affects the size of the automatic data segment.
  16295.  
  16296.  Syntax
  16297.  
  16298.       HEAPSIZE bytes | MAXVAL
  16299.  
  16300.  Remarks
  16301.  
  16302.  The bytes field is an integer number considered decimal by default. However,
  16303.  hexadecimal and octal numbers can be entered by using C notation.
  16304.  
  16305.  MAXVAL is an optional keyword that may be substituted for bytes to set the
  16306.  field parameter. MAXVAL sets the heap size to the value of DGROUP-64K.
  16307.  DGROUP is the automatic or default data segment. The effect is that the
  16308.  loader allocates exactly 64K for DGROUP. This may be useful in bound
  16309.  applications in which you want to force a 64K requirement for DGROUP on the
  16310.  program in DOS. The bound program fails to load if 64K minus the size of
  16311.  DGROUP is less than zero.
  16312.  
  16313.  Examples
  16314.  
  16315.       HEAPSIZE 4000
  16316.  
  16317.       HEAPSIZE MAXVAL
  16318.  
  16319.  
  16320.  19.13  The PROTMODE Statement
  16321.  
  16322.  The PROTMODE statement specifies that the module runs only in protected mode
  16323.  and not in Windows or dual mode. This statement is always optional, and
  16324.  permits a protected-mode-only application to omit some information from the
  16325.  executable-file header.
  16326.  
  16327.  Syntax
  16328.  
  16329.  PROTMODE
  16330.  
  16331.  Remarks
  16332.  
  16333.  If this statement is not included in the module-definition file, the linker
  16334.  assumes the application can be run in either real or protected mode.
  16335.  
  16336.  
  16337.  19.14  The OLD Statement
  16338.  
  16339.  The OLD statement directs the linker to search another dynamic-link module
  16340.  for export ordinals. For more information on ordinals, see the sections
  16341.  above on the EXPORTS and IMPORTS statements. Exported names in the current
  16342.  module that match exported names in the OLD module are assigned ordinal
  16343.  values from that module unless one of the following conditions is in effect:
  16344.  the name in the OLD module has no ordinal value assigned, or an ordinal
  16345.  value is explicitly assigned in the current module.
  16346.  
  16347.  Syntax
  16348.  
  16349.       OLD 'filename'
  16350.  
  16351.  Remarks
  16352.  
  16353.  This statement is useful for preserving export ordinal values throughout
  16354.  successive versions of a dynamic-link module. The OLD has no effect on
  16355.  application modules.
  16356.  
  16357.  
  16358.  19.15  The REALMODE Statement
  16359.  
  16360.  The REALMODE statement is analogous to the PROTMODE statement and is
  16361.  provided for use with real-mode Windows applications.
  16362.  
  16363.  Syntax
  16364.  
  16365.       REALMODE
  16366.  
  16367.  Remarks
  16368.  
  16369.  REALMODE specifies that the application runs only in real mode. With this
  16370.  statement, the linker relaxes some of the restrictions that it imposes on
  16371.  programs running in protected mode.
  16372.  
  16373.  
  16374.  19.16  The EXETYPE Statement
  16375.  
  16376.  The EXETYPE statement specifies in which operating system the application
  16377.  (or dynamic-link library) is to run. This statement is optional and provides
  16378.  an additional degree of protection against the program being run in an
  16379.  incorrect operating system.
  16380.  
  16381.  Syntax
  16382.  
  16383.       EXETYPE «OS2 | WINDOWS | DOS4»
  16384.  
  16385.  Remarks
  16386.  
  16387.  The EXETYPE keyword must be followed by a descriptor of the operating
  16388.  system, either OS2 (for OS/2 applications and dynamic-link libraries),
  16389.  WINDOWS, or DOS4. If no EXETYPE statement is given, EXETYPE OS2 is assumed
  16390.  by an operating system that is loading the program.
  16391.  
  16392.  The effect of EXETYPE is to set bits in the header which identify
  16393.  operating-system type. Operating-system loaders may check these bits.
  16394.  
  16395.  
  16396.  Chapter 20  Creating Dual-Mode Programs with BIND
  16397.  ───────────────────────────────────────────────────────────────────────────
  16398.  
  16399.  The Microsoft Operating System/2 Bind (BIND) utility converts protected-mode
  16400.  programs so they can run in both real mode and protected mode. Not every
  16401.  protected-mode program can readily be converted. Programs you wish to
  16402.  convert should make no system calls other than calls to the functions listed
  16403.  in the Family API. (The Family API, see the Microsoft Operating System/2
  16404.  Programmer's Reference, is a subset of the API functions.)
  16405.  
  16406.  ───────────────────────────────────────────────────────────────────────────
  16407.  NOTE
  16408.     The BIND utility will not work on BASIC programs.
  16409.  ───────────────────────────────────────────────────────────────────────────
  16410.  
  16411.  The BIND utility must "bind" dynamic-link functions──that is, the utility
  16412.  brings an application program together with libraries and links everything
  16413.  into a single stand-alone file that can run in real mode. The BIND utility
  16414.  also alters the executable-file format of the program so it is recognized as
  16415.  a standard executable file in both real mode and protected mode.
  16416.  
  16417.  If you are unable to create a bound version of your program, you can build a
  16418.  dual-mode version, as explained at the end of the chapter.
  16419.  
  16420.  There are three components to the BIND utility:
  16421.  
  16422.    ■  BIND. This utility merges the executable file with the appropriate
  16423.       libraries as described above.
  16424.  
  16425.    ■  Loader. This tool loads the OS/2 executable file when running DOS 2.x
  16426.       or 3.x and simulates the OS/2 startup conditions in a DOS environment.
  16427.       The loader consists of code that is stored in BIND.EXE and copied into
  16428.       files as needed.
  16429.  
  16430.    ■  API.LIB. This library simulates the OS/2 API in a DOS environment.
  16431.  
  16432.  
  16433.  20.1  Binding Library Routines
  16434.  
  16435.  The BIND utility replaces Family-API calls with simulator routines from the
  16436.  standard (object-code) library API.LIB. However, your program may also make
  16437.  dynamic-link calls to functions outside the API (that is, you can make
  16438.  dynamic-link calls that are not system calls). This section explains how
  16439.  BIND can accommodate these calls.
  16440.  
  16441.  If your program makes dynamic-link calls to functions outside the API, use
  16442.  the linklibs field described in Section 20.3, "The BIND Command Line." BIND
  16443.  searches each of the libraries and files specified in linklibs for object
  16444.  code corresponding to the imported functions. In addition, if you are using
  16445.  import definitions with either the ordinal or the internal-name option, you
  16446.  need to specify import libraries so the functions you call can be identified
  16447.  correctly. (For a discussion of various options within import definitions,
  16448.  see Chapter 19, "Using Module-Definition Files.")
  16449.  
  16450.  
  16451.  20.2  Binding Functions as Protected Mode Only
  16452.  
  16453.  If your program freely makes non-Family-API calls without regard to which
  16454.  operating system is in use, the program cannot be converted for use in real
  16455.  mode. However, you may choose to write a program so it first checks the
  16456.  operating system and then restricts system calls (to the Family API) when
  16457.  running in real mode. The BIND utility supports conversion of these
  16458.  programs.
  16459.  
  16460.  By using the /n command-line option described below you can specify a list
  16461.  of functions supported in protected mode only. If your program ever attempts
  16462.  to call one of these functions when running in real mode, the BadDynLink
  16463.  system function is called and aborts your program. The advantage of this
  16464.  option is that it helps resolve external references, yet it remains the
  16465.  responsibility of your program to check the operating-system version and
  16466.  ensure that not one of these functions is ever called in real mode.
  16467.  
  16468.  If your program makes calls (either directly or indirectly) to
  16469.  non-Family-API system calls, but you do not use the /n option, then BIND
  16470.  fails to convert your program.
  16471.  
  16472.  ───────────────────────────────────────────────────────────────────────────
  16473.  NOTE
  16474.     BIND Version 1.0 does not work with files linked with the /EXEPACK
  16475.     option.
  16476.  ───────────────────────────────────────────────────────────────────────────
  16477.  
  16478.  
  16479.  20.3  The BIND Command Line
  16480.  
  16481.  Invoke BIND with the following command line:
  16482.  
  16483.       BIND infile «implibs» «linklibs» «/o outfile» «/n @file» «/n names» «/m
  16484.  
  16485.  The infile field contains the name of the OS/2 application. The file name
  16486.  may contain a complete path name. The file extension is optional; if you
  16487.  provide no extension, .EXE is assumed.
  16488.  
  16489.  The implibs field contains the name of one or more import libraries. As
  16490.  explained above, use this field if your program uses an import definition
  16491.  with either the ordinal or internalname fields.
  16492.  
  16493.  ───────────────────────────────────────────────────────────────────────────
  16494.  NOTE
  16495.     If you want to specify a 64K default data segment when running in real
  16496.     mode, specify the file APILMR.OBJ, which guarantees a 64K stack. The
  16497.     reason this object file may be necessary is that a protected-mode
  16498.     application is not automatically given a 64K default data segment; a
  16499.     protected-mode application is only allocated the space it specifically
  16500.     requests. If you do not specify the file APILMR.OBJ, you may not have the
  16501.     local heap area needed when you run in real mode.
  16502.  ───────────────────────────────────────────────────────────────────────────
  16503.  
  16504.  The linklibs field contains the name of one or more standard libraries and
  16505.  object files. Use this field to supply object code needed to resolve
  16506.  dynamic-link calls. Include DOSCALLS.LIB in this field. You must give the
  16507.  complete path name to DOSCALLS.LIB if it is not in the current directory. If
  16508.  you specify a second library, API.LIB, you need to give the complete path
  16509.  name for it also. If you do not specify API.LIB in this field, BIND
  16510.  automatically searches for API.LIB by looking in directories listed in the
  16511.  LIB environment variable. For example, the following command line
  16512.  successfully uses BIND if API.LIB is located in a directory listed in the
  16513.  LIB environment variable:
  16514.  
  16515.       BIND FOO.EXE \LIB\DOSCALLS.LIB
  16516.  
  16517.  The /o option specifies the name for the bound application, outfile, and may
  16518.  contain a full path name. The default value for this field is the name of
  16519.  the file that was given as infile.
  16520.  
  16521.  The /n option provides a way of listing functions that are supported in
  16522.  protected mode only. As explained above, if any of these functions are ever
  16523.  called in real mode, the BadDynLink function is called to abort the program.
  16524.  The /n option can be used either with a list of one or more names (separated
  16525.  by spaces), or Module Statements Attribute Defined with a file
  16526.  specification preceded by the @ sign. The specified file should consist of a
  16527.  list of functions, one per line.
  16528.  
  16529.  The /m option causes a link map to be generated for the DOS 3.x environment
  16530.  of the .EXE file. The mapfile is the destination of the link map. If mapfile
  16531.  is not specified with the /m option, the destination of the link map is
  16532.  standard output.
  16533.  
  16534.  
  16535.  20.4  BIND Operation
  16536.  
  16537.  BIND produces a single executable file that can run in either real mode or
  16538.  protected mode. To complete this task, BIND executes three major steps:
  16539.  
  16540.    1. Reads in the dynamic-link entry points (for imported functions) from
  16541.       the OS/2 executable file and outputs to a temporary object file the
  16542.       EXTDEF object records for each imported item. Each EXTDEF record tells
  16543.       the linker of an external reference that needs to be resolved through
  16544.       ordinary linking.
  16545.  
  16546.    2. Invokes LINK, giving the executable file, the temporary object file,
  16547.       the API.LIB file, and any other libraries specified on the BIND command
  16548.       line. By linking in the loader and the API-simulator routines, LINK
  16549.       produces an executable file that can run in real mode.
  16550.  
  16551.    3. Merges the protected-mode and real-mode executable files to produce a
  16552.       single file that can run in either mode.
  16553.  
  16554.  ───────────────────────────────────────────────────────────────────────────
  16555.  NOTE
  16556.     A dual-mode executable file produced with BIND can be run in both DOS 2.x
  16557.     and 3.x environments. However, if you change the name of an executable
  16558.     file produced by BIND, then it will not run under DOS 2.x.
  16559.  ───────────────────────────────────────────────────────────────────────────
  16560.  
  16561.  
  16562.  20.5  Executable-File Layout
  16563.  
  16564.  OS/2 executable files have two headers. The first header has a DOS 3.x
  16565.  format. The second header has the OS/2 format. When the executable file is
  16566.  run on an OS/2 system, it ignores the first header and uses the OS/2 format.
  16567.  When run under DOS 3.x, the old header is used to load the file. Figure
  16568.  20.1 shows the arrangement of the merged headers.
  16569.  
  16570.  
  16571.  20.6  How to Build a Dual-Mode Application
  16572.  
  16573.  If you cannot create a bound application out of your program, you may want
  16574.  to create a dual-mode executable (.EXE) file instead. A dual-mode .EXE file
  16575.  is similar to a bound file; both types of files run in either real mode or
  16576.  protected mode. However, the two types of files have a different internal
  16577.  structure.
  16578.  
  16579.  A bound file has common executable code that actually runs in both modes.
  16580.  System calls are specific to real mode or protected mode, but all system
  16581.  calls are modified at load time.
  16582.  
  16583.  In contrast, a dual-mode file has two separate programs contained in one
  16584.  file. One of these programs is real-mode-only and the other is
  16585.  protected-mode-only. All the code in a dual-mode executable file runs in
  16586.  either one mode or the other.
  16587.  
  16588.  To create a dual-mode application:
  16589.  
  16590.    1. Link a real-mode version of your program.
  16591.  
  16592.    2. Create a module-definition file that contains the statement
  16593.  
  16594.            STUB 'PROGR.EXE'
  16595.  
  16596.       in which you substitute the name of your real-mode program for
  16597.       PROGR.EXE.
  16598.  
  16599.    3. Link the protected-mode version of your program with this
  16600.       module-definition file. The protected-mode version and the real-mode
  16601.       version should have different names.
  16602.  
  16603.  
  16604.  Chapter 21  Using EXEHDR
  16605.  ───────────────────────────────────────────────────────────────────────────
  16606.  
  16607.  The Microsoft Segmented-EXE Header Utility (EXEHDR) displays the contents of
  16608.  an executable-file header. You can use EXEHDR with OS/2 or Windows, and you
  16609.  can use it with an application or dynamic-link library. (With a Windows
  16610.  file, some of the meanings of the executable-file-header fields change; see
  16611.  your Windows documentation for more information.) The principal uses of
  16612.  EXEHDR include the following:
  16613.  
  16614.    ■  Determining whether a file is an application or a dynamic-link library
  16615.  
  16616.    ■  Viewing the attributes set by the module-definition file
  16617.  
  16618.    ■  Viewing the number and size of code and data segments
  16619.  
  16620.  Except where noted otherwise, the special terms and keywords mentioned in
  16621.  this section are explained in Chapter 19, "Using Module-Definition Files."
  16622.  
  16623.  
  16624.  21.1  The EXEHDR Command Line
  16625.  
  16626.  To invoke the EXEHDR utility, use the syntax
  16627.  
  16628.       EXEHDR «/v» file
  16629.  
  16630.  in which file is an application or dynamic-link library for either the OS/2
  16631.  or Windows environment. The /v option specifies output in verbose mode.
  16632.  
  16633.  Section 21.2 presents sample output and explains the meaning of each field
  16634.  of the output. Section 21.3 describes additional output that EXEHDR
  16635.  produces when it is run in verbose mode.
  16636.  
  16637.  
  16638.  21.2  EXEHDR Output
  16639.  
  16640.  This section discusses the meaning of each field in the output below──output
  16641.  produced when EXEHDR LINK.EXE is specified on the OS/2 command line. The
  16642.  first six fields list the contents of the segmented-executable-file header.
  16643.  The rest of the output lists each physical segment in the file. (The term
  16644.  "physical segment" is defined in Chapter 14, "Incremental Linking with
  16645.  ILINK.")
  16646.  
  16647.       Module:                   LINK
  16648.       Description:              Microsoft Segmented-Executable Linker
  16649.       Data:                     NONSHARED
  16650.       Initial CS:IP:            seg   2 offset 3d9c
  16651.       Initial SS:SP:            seg   4 offset 8e40
  16652.       DGROUP:                   seg   4
  16653.  
  16654.       no. type address  file  mem   flags
  16655.         1 CODE 00003400 0f208 0f208
  16656.         2 CODE 00012e00 05b04 05b04
  16657.         3 DATA 00018c00 01c1f 01c1f
  16658.         4 DATA 0001aa00 01b10 08e40
  16659.  
  16660.  The Module field is the name of the application as specified in the NAME
  16661.  statement of the module-definition file. If no module definition was used to
  16662.  create the executable file, this field displays the name assumed by default.
  16663.  If a module definition was used to create the file, but the LIBRARY
  16664.  statement appeared instead of the NAME statement (thus specifying a
  16665.  dynamic-link library), the name of the library is given and EXEHDR uses the
  16666.  word Library instead of Module.
  16667.  
  16668.  The Description field gives the contents, if any, of the DESCRIPTION
  16669.  statement of the module-definition file used to create the file being
  16670.  examined.
  16671.  
  16672.  The Data field indicates the type of the program's automatic data segment:
  16673.  SHARED, NONSHARED, or NONE. This type can be specified in a
  16674.  module-definition file, but by default is NONSHARED for applications and
  16675.  SHARED for dynamic-link libraries. In this context, SHARED and NONSHARED are
  16676.  equivalent to the SINGLE and MULTIPLE attributes listed in Section 19.6.
  16677.  (The "automatic data segment" is the physical segment corresponding to the
  16678.  group named DGROUP.)
  16679.  
  16680.  The Initial CS:IP field is the program starting address (if an application
  16681.  is being examined) or address of the initialization routine (if a
  16682.  dynamic-link library is being examined).
  16683.  
  16684.  The Initial SS:SP field gives the value of the initial stack pointer.
  16685.  
  16686.  The DGROUP field is the segment number of the automatic data segment. This
  16687.  segment corresponds to the group named DGROUP in the program's object
  16688.  modules. Note that segment numbers start with the number 1.
  16689.  
  16690.  After the contents of the OS/2 executable header are displayed, the contents
  16691.  of the segment table are listed. The following list describes the meaning of
  16692.  each heading in the table. Note that all values are given in hexadecimal
  16693.  radix except for the segment index number.
  16694.  
  16695. ╓┌───────────────────┌───────────────────────────────────────────────────────╖
  16696.  Heading             Meaning
  16697.  Heading             Meaning
  16698.  
  16699.  no.                 Segment index number, starting with 1, in
  16700.                      decimal radix.
  16701.  
  16702.  type                Identification of the segment as a code or data
  16703.                      segment. A code segment is any segment with
  16704.                      class name ending in 'CODE'. All other segments
  16705.                      are data segments.
  16706.  
  16707.  address             Location, within the file, of the contents of
  16708.                      the segment.
  16709.  
  16710.  file                Size in bytes of the segment, as contained in
  16711.                      the file.
  16712.  
  16713.  mem                 Size in bytes of the segment as it will be
  16714.                      stored in memory. If the value of this field is
  16715.                      greater than the value of the file field, OS/2
  16716.                      pads the additional space with zero values at
  16717.                      load time.
  16718.  Heading             Meaning
  16719.  
  16720.                     load time.
  16721.  
  16722.  flags               Segment attributes, as defined in Chapter 19,
  16723.                      "Using Module-Definition Files." If the /v
  16724.                      option is not used, only nondefault attributes
  16725.                      are listed. Attributes are given in the form
  16726.                      specified in Chapter 19: READWRITE, PRELOAD,
  16727.                      and so forth. Attributes that are meaningful to
  16728.                      Windows but not to OS/2 are displayed as
  16729.                      lowercase and in parentheses, [e.g., (movable)]
  16730.  
  16731.  
  16732.  21.3  Output in Verbose Mode
  16733.  
  16734.  When you specify the /v mode, the EXEHDR utility gives all the information
  16735.  discussed in Section 21.2, as well as some additional information.
  16736.  Specifically, when running in verbose mode, EXEHDR displays the following
  16737.  information in this order:
  16738.  
  16739.    1. DOS 3.x header information. All OS/2 executable files have a DOS 3.x
  16740.       header, whether bound or not. If the program is not bound, the DOS 3.x
  16741.       portion typically consists of a stub that terminates the program. For a
  16742.       de-scription of DOS executable-file-header fields, see the Microsoft
  16743.       MS-DOS Programmer's Reference, or see Chapter 17 in this manual,
  16744.       "Using Other Utilities," for information on the Microsoft EXE File
  16745.       Header Utility (EXEMOD).
  16746.  
  16747.    2. OS/2-specific header fields. This output includes the fields described
  16748.       in Section 21.2 except for the segment table. (The segment-table
  16749.       display for verbose mode is described below.)
  16750.  
  16751.    3. File addresses and lengths of the various tables in the executable
  16752.       file, as in the following example:
  16753.  
  16754.       Resource Table:            00003273 length 0000 (0)
  16755.       Resident Names Table:      00003273 length 0008 (8)
  16756.       Module Reference Table:    0000327b length 0006 (6)
  16757.       Imported Names Table:      00003281 length 0033 (51)
  16758.       Entry Table:               000032b4 length 0002 (2)
  16759.       Non-resident Names Table:  000032b6 length 0029 (41)
  16760.       Movable entry points:      0
  16761.       Segment sector size:       512
  16762.  
  16763.       The first field in each row gives the name of the table, the second
  16764.       field gives the address of the table within the file, the third field
  16765.       gives the length of the table in hexadecimal radix, and the last field
  16766.       gives the length of the table in decimal radix. See the Microsoft
  16767.       Operating System/2 Programmer's Reference for an explanation of each
  16768.       table.
  16769.  
  16770.    4. Segment table with complete attributes, not just the nondefault
  16771.       attributes. In addition to the attributes described in Section 21.2,
  16772.       verbose mode also displays these two additional attributes:
  16773.  
  16774.         ■  The relocs attribute is displayed for each segment that has
  16775.            address relocations. Relocations occur in each segment that
  16776.            references objects in other segments or makes dynamic-link
  16777.            references.
  16778.  
  16779.         ■  The iterated attribute is displayed for each segment that has
  16780.            iterated data. Iterated data consist of a special code that packs
  16781.            repeated bytes; for example, OS/2 executables produced with the
  16782.            /EXEPACK option of LINK have iterated data.
  16783.  
  16784.    5. Run-time relocations and fixups. See the object-module information in
  16785.       the Microsoft Operating System/2 Programmer's Reference for more
  16786.       information.
  16787.  
  16788.    6. Finally, EXEHDR lists all exported entry points. Exports are discussed
  16789.       in Chapter 18, "Linking for Windows and OS/2 Systems," and in Section
  16790.       19.9, "The EXPORTS Statement."
  16791.  
  16792.  
  16793.  Appendix A  Regular Expressions
  16794.  ───────────────────────────────────────────────────────────────────────────
  16795.  
  16796.  Regular expressions are used to specify text patterns in searches for
  16797.  variable text strings. Special characters can be used within regular
  16798.  expressions to specify groups of characters to be searched for.
  16799.  
  16800.  This appendix explains all of the special characters you can use to form
  16801.  regular expressions, but you do not need to learn them all to use the
  16802.  CodeView Search commands. The simplest form of regular expression is simply
  16803.  a text string. For example, if you want to search for all instances of the
  16804.  symbol COUNT, you can specify COUNT as the string to be found.
  16805.  
  16806.  If you want to search only for simple strings, you do not need to read this
  16807.  entire appendix, but you should know how to search for strings containing
  16808.  the special characters used in regular expressions. See Section A.2 for
  16809.  more information.
  16810.  
  16811.  
  16812.  A.1  Special Characters in Regular Expressions
  16813.  
  16814.  The following characters have special meanings in regular expressions:
  16815.  
  16816.  Character                   Purpose
  16817.  
  16818.  Asterisk (*)                Matches any number of repetitions of the
  16819.                              previous character.
  16820.  
  16821.  Backslash (\)               Removes the special characteristics of the
  16822.                              following characters: backslash (\), period (.),
  16823.                              caret (^), dollar sign ($), asterisk (*), and
  16824.                              left bracket ([).
  16825.  
  16826.  Brackets ([ ])              Matches characters specified within the
  16827.                              brackets. The following special characters may
  16828.                              be used:
  16829.  
  16830.                              Character       Purpose
  16831.  
  16832.                              Caret (^)       Reverses the function of the
  16833.                                              brackets. That is, the caret
  16834.                                              matches any character except
  16835.                                              those specified within the
  16836.                                              brackets.
  16837.  
  16838.                              Dash (-)        Matches characters in ASCII
  16839.                                              order between (inclusive of)
  16840.                                              the characters on either
  16841.                                              side of the dash.
  16842.  
  16843.                              Caret (^)       Matches beginning of line.
  16844.  
  16845.                              Dollar sign ($) Matches end of line.
  16846.  
  16847.                              Period (.)      Matches any character.
  16848.  
  16849.  
  16850.  A.2  Searching for Special Characters
  16851.  
  16852.  If you need to match one of the special characters used in regular
  16853.  expressions, precede it with a backslash when you specify a search string.
  16854.  The special charac-ters are the asterisk (*), backslash (\), left bracket
  16855.  ([), caret (^), dollar sign ($), and period (.).
  16856.  
  16857.  For example, the regular expression I*J matches such combinations as J, IJ,
  16858.  IIJ, and IIIJ. The regular expression I\*J matches only I*J. The backslash
  16859.  is necessary because the asterisk (*) is a special character in regular
  16860.  expressions.
  16861.  
  16862.  
  16863.  A.3  Using the Period
  16864.  
  16865.  A period in a regular expression matches any single character. This
  16866.  corresponds to the question mark (?) used in specifying DOS file names.
  16867.  
  16868.  For example, you could use the regular expression AMAX. to search for either
  16869.  of the intrinsic functionsAMAX0 and AMAX1. You could use the expression X.Y
  16870.  to search for strings such as X+Y, X-Y, or X*Y. If your programming style is
  16871.  to put a space between variables and operators, you could use the regular
  16872.  expression X.Y for the same purpose.
  16873.  
  16874.  Note that when you use the period as a wild card, you will find the strings
  16875.  you are looking for, but you may also find other strings that you aren't
  16876.  interested in. You can use brackets to be more exact about the strings you
  16877.  want to find.
  16878.  
  16879.  
  16880.  A.4  Using Brackets
  16881.  
  16882.  You can use brackets to specify a character or characters you want to match.
  16883.  Any of the characters listed within the brackets is an acceptable match.
  16884.  This method is more exact than using a period to match any character.
  16885.  
  16886.  For example, the regular expression x[-+/*]y matches x+y, x-y, x/y, or x*y,
  16887.  but not x=y or xzy. The regular expression COUNT[12] matches COUNT1 and
  16888.  COUNT2, but not COUNT3.
  16889.  
  16890.  Most regular-expression special characters have no special meaning when used
  16891.  within brackets. The only special characters within brackets are the caret
  16892.  (^), dash (-), and right bracket (]). Even these characters only have
  16893.  special meanings in certain contexts, as explained in Sections A.4.1-A.4.3.
  16894.  
  16895.  
  16896.  A.4.1  Using the Dash within Brackets
  16897.  
  16898.  The dash (minus sign) can be used within brackets to specify a group of
  16899.  sequential ASCII characters. For example, the regular expression [0-9]
  16900.  matches any digit; it is equivalent to [0123456789]. Similarly, [a-z]
  16901.  matches any lowercase letter, and [A-Z] matches any uppercase letter.
  16902.  
  16903.  You can combine ASCII ranges of characters with other listed characters. For
  16904.  example, [A-Za-z ] matches any uppercase or lowercase letter or a space.
  16905.  
  16906.  The dash has this special meaning only if you use it to separate two ASCII
  16907.  characters. It has no special meaning if used directly after the starting
  16908.  bracket or directly before the ending bracket. This means you must be
  16909.  careful where you place the dash (minus sign) within brackets.
  16910.  
  16911.  For example, you might use the regular expression [+-/*] to match the
  16912.  characters +, -, /, and *. However, this does not give the intended result.
  16913.  Instead it matches the characters between + and / and also the character *.
  16914.  To specify the intended characters, put the dash first or last in the list:
  16915.  [-+/*] or [+/*-].
  16916.  
  16917.  
  16918.  A.4.2  Using the Caret within Brackets
  16919.  
  16920.  If used as the first character within brackets, the caret (^) reverses the
  16921.  meaning of the brackets. That is, any character except the ones in brackets
  16922.  is matched. For example, the regular expression [^0-9] matches any character
  16923.  that is not a digit. Specifying the characters to be excluded is often more
  16924.  concise than specifying the characters you want to match.
  16925.  
  16926.  If the caret is not in the first position within the brackets, it is treated
  16927.  as an ordinary character. For example, the expression [0-9^] matches any
  16928.  digit or a caret.
  16929.  
  16930.  
  16931.  A.4.3  Matching Brackets within Brackets
  16932.  
  16933.  Sometimes you may want to specify the bracket characters as characters to be
  16934.  matched. This is no problem with the left bracket; it is treated as a normal
  16935.  character. However, the right bracket is interpreted as the end of the
  16936.  character list rather than as a character to be matched.
  16937.  
  16938.  If you want the right bracket to be matched, you must make it the first
  16939.  character after the initial left bracket. For example, the regular
  16940.  expression []#![@%] matches either bracket character or any of the other
  16941.  characters listed within the brackets. However, if you changed the order of
  16942.  just one of the characters (to [#]![@%]), the meaning would be changed so
  16943.  that you would be specifying two groups of characters in brackets: [#] and
  16944.  [@%].
  16945.  
  16946.  
  16947.  A.5  Using the Asterisk
  16948.  
  16949.  The asterisk matches zero or more occurrences of the character preceding the
  16950.  asterisk.
  16951.  
  16952.  For example, the regular expression IF * TEST matches any number of
  16953.  repetitions of the space character that follow the word "if."
  16954.  
  16955.       IF TEST
  16956.       IF        TEST
  16957.       IF TEST
  16958.       IFTEST
  16959.  
  16960.  Notice that the last example contains zero repetitions of the space
  16961.  character.
  16962.  
  16963.  The asterisk is convenient if the text you are searching for might contain
  16964.  some spaces, but you don't know the exact number. (Be careful in this
  16965.  situation: you can't be sure if the text contains a series of spaces or a
  16966.  tab.)
  16967.  
  16968.  You might also use the asterisk to search for a symbol when you aren't sure
  16969.  of the spelling. For example, you could use first*ime if you aren't sure if
  16970.  the identifier you are searching for is spelled firsttime or firstime.
  16971.  
  16972.  One particularly powerful use of the asterisk is to combine it with the
  16973.  period (.*). This combination searches for any group of characters. It is
  16974.  similar to the asterisk used in specifying DOS file names. For example, the
  16975.  expression (.*) matches (test), (response .EQ. 'Y'), (x=0;x .LE. 20;x=x+1),
  16976.  or any other string that starts with a left parenthesis and ends with a
  16977.  right parenthesis.
  16978.  
  16979.  You can use brackets with the asterisk to search for a sequence of repeated
  16980.  characters of a given type. For example, \[[0-9]*] matches number strings
  16981.  within brackets ([1353] or [3]), but does not match character strings within
  16982.  brackets ([count]). Empty brackets ([]) are also matched since the
  16983.  characters in the brackets are repeated zero times.
  16984.  
  16985.  
  16986.  A.6  Matching the Start or End of a Line
  16987.  
  16988.  In regular expressions, the caret (^) matches the start of a line, and the
  16989.  dollar sign ($) matches the end of a line.
  16990.  
  16991.  For example, the regular expression ^C matches any uppercase C that starts a
  16992.  line. Similarly, )$ matches a right parenthesis at the end of a line, but
  16993.  not a right parenthesis within a line.
  16994.  
  16995.  You can combine both symbols to search for entire lines. For example, ^{$
  16996.  matches any line consisting of only a left curly brace in the left margin
  16997.  and ^$ matches blank lines.
  16998.  
  16999.  
  17000.  
  17001.  Appendix B  Using Exit Codes
  17002.  ───────────────────────────────────────────────────────────────────────────
  17003.  
  17004.  Most utilities return an exit code (sometimes called an "errorlevel" code)
  17005.  used by DOS batch files or other programs. If the program finishes without
  17006.  errors, it returns an exit code 0. The code varies if the program encounters
  17007.  an error.
  17008.  
  17009.  
  17010.  B.1  Exit Codes with NMAKE
  17011.  
  17012.  The NMAKE stops execution if a program executed by one of the commands in
  17013.  the NMAKE description file encounters an error. (Invoke NMAKE with the /I
  17014.  option to disable this behavior for the entire description file, or place a
  17015.  minus sign (-) in front of a command to disable it only for that command.)
  17016.  The exit code returned by the program is displayed as part of the error
  17017.  message.
  17018.  
  17019.  Assume the NMAKE description file TEST contains the following lines:
  17020.  
  17021.       TEST.OBJ :     TEST.FOR
  17022.             FL /c TEST.FOR
  17023.  
  17024.  If the source code in TEST.FOR contains a program error (but not if it
  17025.  contains a warning error), you would see the following message the first
  17026.  time you use NMAKE with the NMAKE description file TEST:
  17027.  
  17028.       "nmake: CL /c TEST.FOR - error 2"
  17029.  
  17030.  This error message indicates that the command CL /c TEST.FOR in the NMAKE
  17031.  description file returned exit code 2.
  17032.  
  17033.  You can also test exit codes in NMAKE description files with the !IF
  17034.  directive.
  17035.  
  17036.  
  17037.  B.2  Exit Codes with DOS Batch Files
  17038.  
  17039.  If you prefer to use DOS batch files instead of NMAKE description files, you
  17040.  can test the code returned with the IF command. The following sample batch
  17041.  file, called COMPILE.BAT, illustrates how to do this:
  17042.  
  17043.       CL /c %1
  17044.       IF NOT ERRORLEVEL 1 LINK %1;
  17045.       IF NOT ERRORLEVEL 1 %1
  17046.  
  17047.  You can execute this sample batch file with the following command:
  17048.  
  17049.       COMPILE TEST.C
  17050.  
  17051.  DOS then executes the first line of the batch file, substituting TEST.C for
  17052.  the parameter %1, as in the command line below.
  17053.  
  17054.       CL /c TEST.C
  17055.  
  17056.  It returns an exit code 0 if the compilation is successful or a higher code
  17057.  if the compiler encounters an error. In the second line, DOS tests to see if
  17058.  the code returned by the previous line is 1 or higher. If it is not (that
  17059.  is, if the code is 0), DOS executes the following command:
  17060.  
  17061.       LINK TEST;
  17062.  
  17063.  LINK also returns a code that is tested by the third line.
  17064.  
  17065.  
  17066.  B.3  Exit Codes for Programs
  17067.  
  17068.  An exit code 0 always indicates execution of the program with no fatal
  17069.  errors. Warning errors also return exit code 0. NMAKE can return several
  17070.  codes indica-ting different kinds of errors; other programs return only one
  17071.  code. The exit codes for each program are listed in Sections B.3.1-B.3.4.
  17072.  
  17073.  
  17074.  B.3.1  LINK Exit Codes
  17075.  
  17076.  Code                       Meaning
  17077.  
  17078.  0                          No error.
  17079.  
  17080.  2                          Program error. Commands or files given as input
  17081.                             to the linker produced the error.
  17082.  
  17083.  4                          System error. The linker encountered one of the
  17084.                             following problems: 1) ran out of space on output
  17085.                             files; 2) was unable to reopen the temporary
  17086.                             file; 3) experienced an internal error; 4) was
  17087.                             interrupted by the user.
  17088.  
  17089.  
  17090.  
  17091.  B.3.2  LIB Exit Codes
  17092.  
  17093.  Code                       Meaning
  17094.  
  17095.  0                          No error.
  17096.  
  17097.  2                          Program error. Commands or files given as input
  17098.                             to the utility produced the error.
  17099.  
  17100.  4                          System error. The library manager encountered one
  17101.                             of the following problems: 1) ran out of memory;
  17102.                             2) experienced an internal error; 3) was
  17103.                             interrupted by the user.
  17104.  
  17105.  
  17106.  B.3.3  NMAKE Exit Codes
  17107.  
  17108.  Code                       Meaning
  17109.  
  17110.  0                          No error
  17111.  
  17112.  2                          Program error
  17113.  
  17114.  4                          System error──out of memory
  17115.  
  17116.  
  17117.  If a program called by a command in the NMAKE description file produces an
  17118.  error, the exit code is displayed in the NMAKE error message.
  17119.  
  17120.  
  17121.  B.3.4  EXEMOD and SETENV Exit Codes
  17122.  
  17123.  Code                       Meaning
  17124.  
  17125.  0                          No error.
  17126.  
  17127.  2                          Program error. Commands or files given as input
  17128.                             to the utility produced the error.
  17129.  
  17130.  4                          System error. The utility encountered one of the
  17131.                             following problems: 1) ran out of memory; 2)
  17132.                             experienced an internal error; 3) was interrupted
  17133.                             by the user.
  17134.  
  17135.  
  17136.  B.3.5  CVPACK Exit Codes
  17137.  
  17138.  Code                       Meaning
  17139.  
  17140.  0                          No error.
  17141.  
  17142.  1                          Program error.  Commands or files given as
  17143.                             input to the utility produced the error.
  17144.  
  17145.  Appendix C  Error Messages
  17146.  ───────────────────────────────────────────────────────────────────────────
  17147.  
  17148.  
  17149.  C.1  CodeView Error Messages
  17150.  
  17151.  The CodeView debugger displays an error message whenever it detects a
  17152.  command it cannot execute. Most errors (start-up errors are the exception)
  17153.  terminate the CodeView command under which the error occurred but do not
  17154.  terminate the debugger. You may see any of the following messages.
  17155.  
  17156.  ? cannot display
  17157.  
  17158.            The Display Expression command (?) has been passed a valid symbol
  17159.            it cannot display. A variable with enumeration type cannot be
  17160.            displayed.
  17161.  
  17162.  Argument to IMAG/DIMAG must be simple type
  17163.  
  17164.            You specified an argument to an IMAG or DIMAG function not
  17165.            permitted, such as an array with no subscripts.
  17166.  
  17167.  Array must have subscript
  17168.  
  17169.            You specified an array without any subscripts in an expression,
  17170.            such as IARRAY+2. A correct example would be IARRAY[1]+2.
  17171.  
  17172.  Bad address
  17173.  
  17174.            You specified an address in an invalid form.
  17175.  
  17176.            For instance, you may have entered an address containing
  17177.            hexadecimal characters when the radix is decimal.
  17178.  
  17179.  Bad breakpoint command
  17180.  
  17181.            You typed an invalid breakpoint number with the Breakpoint Clear,
  17182.            Breakpoint Disable, or Breakpoint Enable command.
  17183.  
  17184.            The number must be in the range 0 to 19.
  17185.  
  17186.  Bad emulator info
  17187.  
  17188.            The CodeView debugger cannot read data from the floating-point
  17189.            emulator.
  17190.  
  17191.  Bad flag
  17192.  
  17193.            You specified an invalid flag mnemonic with the Register dialog
  17194.            command (R).
  17195.  
  17196.            Use one of the mnemonics displayed when you enter the command RF.
  17197.  
  17198.  Bad format string
  17199.  
  17200.            You used an invalid format specifier following an expression.
  17201.  
  17202.            Expressions used with the Display Expression, Watch, Watchpoint,
  17203.            and Tracepoint commands can have CodeView format specifiers set
  17204.            off from the expression by a comma. The valid format specifiers
  17205.            are c, d, e, E, f, g, G, i, o, s, u, x, X. Some format specifiers
  17206.            can be preceded by the prefix h or l. See the Display Expression
  17207.            command for more information about format specifiers.
  17208.  
  17209.  Bad integer or real constant
  17210.  
  17211.            You specified an illegal numeric constant in an expression.
  17212.  
  17213.  Bad intrinsic function
  17214.  
  17215.            You specified an illegal intrinsic function name in an expression.
  17216.  
  17217.  Bad radix (use 8, 10, or 16)
  17218.  
  17219.            With the N command, you can use only octal, decimal, and
  17220.            hexadecimal radixes.
  17221.  
  17222.  Bad register
  17223.  
  17224.            You typed the Register command (R) with an invalid register name.
  17225.  
  17226.            Use AX, BX, CX, DX, SP, BP, SI, DI, DS, ES, SS, CS, IP, or F.
  17227.  
  17228.  Bad subscript
  17229.  
  17230.            You entered an illegal subscript expression for an array, such as
  17231.            IARRAY(3.3) or IARRAY((3,3)). The correct expression for this
  17232.            example (in BASIC or FORTRAN) is IARRAY(3,3).
  17233.  
  17234.  Bad type case
  17235.  
  17236.            The types of the operands in an expression are incompatible.
  17237.  
  17238.  Bad type (use one of 'ABDILSTUW')
  17239.  
  17240.            The valid dump types are ASCII (A), Byte (B), Double Word (D),
  17241.            Integer (I), Long Real (L), Short Real (S), 10-Byte Real (T),
  17242.            Unsigned (U), and Word (W).
  17243.  
  17244.  Badly formed type
  17245.  
  17246.            The type information in the symbol table of the file you are
  17247.            debugging is incorrect.
  17248.  
  17249.            If the message occurs, please note the circumstances of the error
  17250.            and inform Microsoft Corporation by following the directions in
  17251.            the Microsoft Product Assistance Request form at the back of one
  17252.            of your manuals.
  17253.  
  17254.  Breakpoint # or '*' expected
  17255.  
  17256.            You entered the Breakpoint Clear (BC), Breakpoint Disable (BD), or
  17257.            Breakpoint Enable (BE) command with no argument.
  17258.  
  17259.            These commands require that you specify the number of the
  17260.            breakpoint to be acted on, or that you specify the asterisk (*)
  17261.            indicating that all breakpoints are to be acted on.
  17262.  
  17263.  Cannot use struct or union as scalar
  17264.  
  17265.            A struct or union variable cannot be used as a scalar value in a C
  17266.            expression.
  17267.  
  17268.            Such variables must be followed by a file separator or preceded by
  17269.            the address of operator.
  17270.  
  17271.  Cannot cast complex constant component into REAL
  17272.  
  17273.            Both the real and imaginary components of a COMPLEX constant must
  17274.            be compatible with the type REAL.
  17275.  
  17276.  Cannot cast IMAG/DIMAG argument to COMPLEX
  17277.  
  17278.            Arguments to IMAG and DIMAG must be simple numeric types.
  17279.  
  17280.  Cannot find filename
  17281.  
  17282.            The CodeView debugger could not find the executable file you
  17283.            specified when you started.
  17284.  
  17285.            You may have misspelled the file name, or the file is in a
  17286.            different directory.
  17287.  
  17288.  Character constant too long
  17289.  
  17290.            You specified a character constant too long for the FORTRAN
  17291.            expression evaluator (the limit is 126 bytes).
  17292.  
  17293.  Character too big for current radix
  17294.  
  17295.            In a constant, you specified a radix that is larger than the
  17296.            current CodeView radix.
  17297.  
  17298.            Use the N command to change the radix.
  17299.  
  17300.  Constant too big
  17301.  
  17302.            The CodeView debugger cannot accept an unsigned constant number
  17303.            larger than 4,294,967,295 (16#FFFFFFFF).
  17304.  
  17305.  CPU not an 80386
  17306.  
  17307.            The 386 option cannot be selected if you are using a machine
  17308.            without an 80386 processor.
  17309.  
  17310.  Divide by zero
  17311.  
  17312.            An expression in an argument of a dialog command attempts to
  17313.            divide by zero.
  17314.  
  17315.  EMM error
  17316.  
  17317.            The debugger is failing to use EMM correctly. Please contact
  17318.            Microsoft Corporation by following the directions in the Microsoft
  17319.            Product Assistance Request form at the back of one of your
  17320.            manuals.
  17321.  
  17322.  EMM hardware error
  17323.  
  17324.            The Expanded Memory routines report a hardware error. Your
  17325.            expanded memory board may need replacement.
  17326.  
  17327.  EMM memory not found
  17328.  
  17329.            You tried to use the /E option without having installed expanded
  17330.            memory. You must make this installation with software that
  17331.            accesses the memory according to the Lotus/Intel/Microsoft EMS
  17332.            specification.
  17333.  
  17334.  EMM software error
  17335.  
  17336.            The Expanded Memory routines report a software error. Reinstall
  17337.            EMM software.
  17338.  
  17339.  Expression not a memory address
  17340.  
  17341.            A Tracepoint command was given without a symbol that evaluates to
  17342.            a single memory address.
  17343.  
  17344.            For example, the commands TP?1 and TP?a+b each produce this error
  17345.            message. The proper way to put a tracepoint on the word at address
  17346.            1 is with the command TPW 1.
  17347.  
  17348.  Expression too complex
  17349.  
  17350.            An expression given as a dialog-command argument is too complex.
  17351.  
  17352.            Try simplifying the expression.
  17353.  
  17354.  Extra input ignored
  17355.  
  17356.            You specified too many arguments to a command.
  17357.  
  17358.            The CodeView debugger evaluates the valid arguments and ignores
  17359.            the rest. Often in this situation the debugger does not evaluate
  17360.            the arguments in the way you intended.
  17361.  
  17362.  Flip/Swap option off - application output lost
  17363.  
  17364.            The program you are debugging is writing to the screen, but the
  17365.            output cannot be displayed because you have turned off the
  17366.            flip/swap option.
  17367.  
  17368.  Floating point error
  17369.  
  17370.            This message should not occur, but if it does, please note the
  17371.            circumstances of the error and inform Microsoft Corporation by
  17372.            following the directions in the Microsoft Product Assistance
  17373.            Request form at the back of one of your manuals.
  17374.  
  17375.  Floating point not loaded
  17376.  
  17377.            This message occurs when the current thread has not initialized
  17378.            its own emulator. Each thread has its own floating-point emulator.
  17379.  
  17380.  Function call before 'main'
  17381.  
  17382.            This message occurs when you attempt to evaluate a program-defined
  17383.            function before you have entered the main function.
  17384.  
  17385.            Execute at least to the beginning of the main function before
  17386.            attempting to evaluate program-defined functions.
  17387.  
  17388.  Illegal instruction
  17389.  
  17390.            This message usually indicates that a divide-by-zero machine
  17391.            instruction was attempted.
  17392.  
  17393.  Index out of bound
  17394.  
  17395.            You specified a subscript value outside the bounds declared for
  17396.            the array.
  17397.  
  17398.  Insufficient EMM memory
  17399.  
  17400.            Not enough expanded memory is available to hold the program's
  17401.            symbol table.
  17402.  
  17403.  Internal debugger error
  17404.  
  17405.            If this message occurs, please note the circumstances of the error
  17406.            and notify Microsoft Corporation by following the directions in
  17407.            the Microsoft Product Assistance Request form at the back of one
  17408.            of your manuals.
  17409.  
  17410.  Invalid argument
  17411.  
  17412.            One of the arguments you specified is not a valid CodeView
  17413.            expression.
  17414.  
  17415.  Invalid executable file format - please relink
  17416.  
  17417.            The executable file was not linked with the version of the linker
  17418.            released with this version of the CodeView debugger. Relink with
  17419.            the more current version of the linker.
  17420.  
  17421.  Invalid option
  17422.  
  17423.            The option specified cannot be used with the CodeView Option
  17424.            command.
  17425.  
  17426.  Missing '"'
  17427.  
  17428.            You specified a string as an argument to a dialog command, but you
  17429.            did not supply a closing double quotation mark.
  17430.  
  17431.  Missing '('
  17432.  
  17433.            An argument to a dialog command was specified as an expression
  17434.            containing a right parenthesis, but no left parenthesis.
  17435.  
  17436.  Missing ')'
  17437.  
  17438.            An argument to a dialog command was specified as an expression
  17439.            containing a left parenthesis, but no right parenthesis.
  17440.  
  17441.  Missing ']'
  17442.  
  17443.            An argument to a dialog command was specified as an expression
  17444.            containing a left bracket, but no right bracket.
  17445.  
  17446.            This error message can also occur if a regular expression is
  17447.            specified with a right bracket but no left bracket.
  17448.  
  17449.  Missing '(' in complex constant
  17450.  
  17451.            The debugger is expecting an opening parenthesis of a complex
  17452.            constant in an expression, but it is missing.
  17453.  
  17454.  Missing ')' in complex constant
  17455.  
  17456.            The debugger expects a closing parenthesis of a complex constant
  17457.            in an expression.
  17458.  
  17459.  Missing ')' in substring
  17460.  
  17461.            The debugger expects a closing parenthesis of a substring
  17462.            expression.
  17463.  
  17464.  Missing '(' to intrinsic
  17465.  
  17466.            The debugger expects an opening parenthesis for an intrinsic
  17467.            function.
  17468.  
  17469.  Missing ')' to intrinsic
  17470.  
  17471.            The debugger expects a closing parenthesis for an intrinsic
  17472.            function.
  17473.  
  17474.  No closing single quote
  17475.  
  17476.            You specified a character in an expression used as a
  17477.            dialog-command argument, but the closing single quotation mark is
  17478.            missing.
  17479.  
  17480.  No code at this line number
  17481.  
  17482.            You tried to set a breakpoint on a source line that does not
  17483.            correspond to machine code. (In other words, the source line does
  17484.            not contain an executable statement.)
  17485.  
  17486.            For instance, the line may be a data declaration or a comment.
  17487.  
  17488.  No free EMM memory handles
  17489.  
  17490.            The debugger cannot find an available handle. EMM software
  17491.            allocates a fixed number of memory handles (usually 256) to be
  17492.            used for specific tasks.
  17493.  
  17494.  No match of regular expression
  17495.  
  17496.            No match was found for the regular expression you specified with
  17497.            the Search command or with the Find selection from the Search
  17498.            menu.
  17499.  
  17500.  No previous regular expression
  17501.  
  17502.            You selected Previous from the Search menu, but there was no
  17503.            previous match for the last regular expression specified.
  17504.  
  17505.  No source lines at this address
  17506.  
  17507.            The address you specified as an argument for the View command (V)
  17508.            does not have any source lines.
  17509.  
  17510.            For instance, it could be an address in a library routine or an
  17511.            assembly-language module.
  17512.  
  17513.  No such file/directory
  17514.  
  17515.            A file specified in a command argument or in response to a prompt
  17516.            does not exist.
  17517.  
  17518.            For instance, the message appears when you select Load from the
  17519.            File menu and then enter the name of a nonexistent file.
  17520.  
  17521.  No symbolic information = CV options not used or wrong LINK version
  17522.  
  17523.            The program file you specified is not in the CodeView format.
  17524.  
  17525.            You cannot debug in source mode unless you recreate the file in
  17526.            CodeView format. However, you can debug in assembly mode.
  17527.  
  17528.  Not a text file
  17529.  
  17530.            You attempted to load a file by using the Load selection from the
  17531.            File menu or using the View command, but the file is not a text
  17532.            file.
  17533.  
  17534.            The CodeView debugger determines if a file is a text file by
  17535.            checking the first 128 bytes for characters that are not in the
  17536.            ASCII ranges 9 to 13 and 20 to 126.
  17537.  
  17538.  Not an executable file
  17539.  
  17540.            The file you specified to be debugged when you started the
  17541.            CodeView debugger is not an executable file having the extension
  17542.            .EXE or .COM.
  17543.  
  17544.  Not enough space
  17545.  
  17546.            You typed the Shell Escape command (!) or selected Shell from the
  17547.            File menu, but there is not enough free memory to execute
  17548.            COMMAND.COM.
  17549.  
  17550.            Since memory is released by code in the FORTRAN start-up routines,
  17551.            this error always occurs if you try to use the Shell Escape
  17552.            command before you have executed any code. Use any of the
  17553.            code-execution commands (Trace, Program Step, or Go) to execute
  17554.            the FORTRAN start-up code, then try the Shell Escape command
  17555.            again. The message also occurs with assembly-language programs
  17556.            that do not specifically release memory.
  17557.  
  17558.  Object too big
  17559.  
  17560.            You entered a Tracepoint command with a data object (such as an
  17561.            array) larger than 128 bytes.
  17562.  
  17563.  Operand types incorrect for this operation
  17564.  
  17565.            An operand in a FORTRAN expression had a type incompatible with
  17566.            the operation applied to it.
  17567.  
  17568.            For example, if P is declared as CHARACTER P(10), the ? P+5 would
  17569.            produce this error, since a character array cannot be an operand
  17570.            of an arithmetic operator.
  17571.  
  17572.  Operator must have a struct\union type
  17573.  
  17574.            You have used one of the C member-selection operators (-, >, or .)
  17575.            in an expression that does not reference an element of a structure
  17576.            or union.
  17577.  
  17578.  Operator needs lvalue
  17579.  
  17580.            You specified an expression that does not evaluate to a memory
  17581.            location in an operation that requires one. (An lvalue is an
  17582.            expression that refers to a memory location.)
  17583.  
  17584.            For example, buffer(count) is correct because it represents a
  17585.            symbol in memory. However, I .EQV. 10 is invalid because it
  17586.            evaluates to TRUE or FALSE instead of to a single memory location.
  17587.  
  17588.  Overlay not resident
  17589.  
  17590.            You tried to unassemble machine code from a function that is
  17591.            currently not in memory.
  17592.  
  17593.  Program terminated normally (number)
  17594.  
  17595.            You executed your program to the end. The number displayed in
  17596.            parentheses is the exit code returned to DOS by your program.
  17597.  
  17598.            You must use the Restart command (or the Start menu selection) to
  17599.            start the program before executing more code.
  17600.  
  17601.  Radix must be between 2 and 36 inclusive
  17602.  
  17603.            You specified a radix outside the allowable range.
  17604.  
  17605.  
  17606.  Register variable out of scope
  17607.  
  17608.            You tried to specify a register variable by using the period (.)
  17609.            operator and a routine name.
  17610.  
  17611.            For example, if you are in a third-level routine, you can display
  17612.            the value of a local variable called local in a second-level
  17613.            routine called parent with the following command:
  17614.  
  17615.                 ? parent.local
  17616.  
  17617.            However, this command will not work if local is declared as a
  17618.            register variable.
  17619.  
  17620.  Regular expression too complex
  17621.  
  17622.            The regular expression specified is too complex for the CodeView
  17623.            debugger to evaluate.
  17624.  
  17625.  Regular expression too long
  17626.  
  17627.            The regular expression specified is too long for the CodeView
  17628.            debugger to evaluate.
  17629.  
  17630.  Restart program to debug
  17631.  
  17632.            You have executed to the end of the program you are debugging.
  17633.  
  17634.  Simple variable cannot have argument
  17635.  
  17636.            In an expression, you specified an argument to a simple variable.
  17637.  
  17638.            For example, given the declaration INTEGER NUM, the expression
  17639.            NUM(I) is not allowed.
  17640.  
  17641.  Substring range out of bound
  17642.  
  17643.            A character expression exceeds the length specified in the
  17644.            CHARACTER statement.
  17645.  
  17646.  Syntax error
  17647.  
  17648.            You specified an invalid command line for a dialog command.
  17649.  
  17650.            Check for an invalid command letter. This message also appears if
  17651.            you enter an invalid assembly-language instruction using the
  17652.            Assembly command. The error is preceded by a caret that points to
  17653.            the first character the CodeView debugger could not interpret.
  17654.  
  17655.  Too few array bounds given
  17656.  
  17657.            The bounds that you specified in an array subscript do not match
  17658.            the array declaration.
  17659.  
  17660.            For example, given the array declaration INTEGER IARRAY(3,4), the
  17661.            expression IARRAY(I) would produce this error message.
  17662.  
  17663.  Too many array bounds given
  17664.  
  17665.            The bounds that you specified in an array subscript do not match
  17666.            the array declaration.
  17667.  
  17668.            For example, given the array declaration INTEGER IARRAY(3,4), the
  17669.            expression IARRAY(I,3,J) would produce this error message.
  17670.  
  17671.  Too many breakpoints
  17672.  
  17673.            You tried to specify a 21st breakpoint; the CodeView debugger
  17674.            permits only 20.
  17675.  
  17676.  Too many open files
  17677.  
  17678.            You do not have enough file handles for the CodeView debugger to
  17679.            operate correctly.
  17680.  
  17681.            You must specify more files in your CONFIG.SYS file. See the DOS
  17682.            user's guide for information on using the CONFIG.SYS file.
  17683.  
  17684.  Type clash in function argument
  17685.  
  17686.            The type of an actual parameter does not match the corresponding
  17687.            formal parameter.
  17688.  
  17689.            This message also appears when a subroutine that uses alternate
  17690.            returns is called and the values of the return labels in the
  17691.            actual parameter list are not 0.
  17692.  
  17693.  Type conversion too complex
  17694.  
  17695.            You tried to type cast an element of an expression in a type other
  17696.            than the simple types or with more than one level of indirection.
  17697.  
  17698.            An example of a complex type would be type casting to a struct or
  17699.            union type. An example of two levels of indirection is char **.
  17700.  
  17701.  Unable to open file
  17702.  
  17703.            A file you specified in a command argument or in response to a
  17704.            prompt cannot be opened.
  17705.  
  17706.            For instance, this message appears when you select Load from the
  17707.            File menu, and then enter the name of a file that is corrupted or
  17708.            has its file attributes set so that it cannot be opened.
  17709.  
  17710.  Unknown symbol
  17711.  
  17712.            You specified an identifier not in the CodeView debugger's symbol
  17713.            table.
  17714.  
  17715.            Check for a misspelling. This message may also occur if you try to
  17716.            use a local variable in an argument when you are not in the
  17717.            routine where the variable is defined. The message also occurs
  17718.            when a subroutine that uses alternate returns is called and the
  17719.            values of the return labels in the actual parameter list are
  17720.            not 0.
  17721.  
  17722.  Unrecognized option option
  17723.  Valid options: /B /C<command> /D /F /I /M /S /T /W /43 /2
  17724.  
  17725.            You entered an invalid option when starting the CodeView debugger.
  17726.  
  17727.            Try retyping the command line.
  17728.  
  17729.  Usage cv [options] file [arguments]
  17730.  
  17731.            You failed to specify an executable file when you started
  17732.            CodeView.
  17733.  
  17734.            Try again with the syntax shown in the message.
  17735.  
  17736.  Video mode changed without the /S option
  17737.  
  17738.            The program changed video modes (either to or from graphics modes)
  17739.            when screen swapping was not specified.
  17740.  
  17741.            You must use the /S option to specify screen swapping when
  17742.            debugging graphics programs. You can continue debugging when you
  17743.            get this message, but the output screen of the debugged program
  17744.            may be damaged.
  17745.  
  17746.  Warning: packed file
  17747.  
  17748.            You started the CodeView debugger with a packed file as the
  17749.            executable file.
  17750.  
  17751.            You can attempt to debug the program in assembly mode, but the
  17752.            packing routines at the start of the program may make this
  17753.            difficult. You cannot debug in source mode because all symbolic
  17754.            information is stripped from a file when it is packed with the
  17755.            /EXEPACK linker option.
  17756.  
  17757.  Wrong number of function arguments
  17758.  
  17759.            You specified an incorrect number of arguments when you tried to
  17760.            evaluate a function in a CodeView expression.
  17761.  
  17762.  
  17763.  C.2  LINK Error Messages
  17764.  
  17765.  This section lists and describes error messages generated by the Microsoft
  17766.  Segmented-Executable Linker, LINK.
  17767.  
  17768.  Fatal errors cause the linker to stop execution. Fatal error messages have
  17769.  the following format:
  17770.  
  17771.       location:  error L1xxx: messagetext
  17772.  
  17773.  Nonfatal errors indicate problems in the executable file. LINK produces the
  17774.  executable file. Nonfatal error messages have the following format:
  17775.  
  17776.       location :  error L2xxx:messagetext
  17777.  
  17778.  Warnings indicate possible problems in the executable file. LINK produces
  17779.  the executable file. Warnings have the following format:
  17780.  
  17781.       location :  warning L4xxx:messagetext
  17782.  
  17783.  In all three kinds of messages, location is the input file associated with
  17784.  the error, or LINK if there is no input file. If the input file is an .OBJ
  17785.  or .LIB file and has a module name, the module name is enclosed in
  17786.  parentheses, as shown below.
  17787.  
  17788.       SLIBC.LIB(_file)
  17789.       MAIN.OBJ(main.c)
  17790.       TEXT.OBJ
  17791.  
  17792.  The following error messages may appear when you link object files with the
  17793.  Microsoft Segmented-Executable Linker, LINK.
  17794.  
  17795.  
  17796.  C.3.1  LINK Fatal Error Messages
  17797.  
  17798.  L1001     option : option name ambiguous
  17799.  
  17800.            A unique option name did not appear after the option indicator
  17801.            (/). For example, the command
  17802.  
  17803.            LINK /N main;
  17804.  
  17805.            generates this error, since LINK cannot tell which of the options
  17806.            beginning with the letter "N" was intended.
  17807.  
  17808.  L1002     option : unrecognized option name
  17809.  
  17810.            An unrecognized character followed the option indicator (/), as
  17811.            shown below.
  17812.  
  17813.            LINK /ABCDEF main;
  17814.  
  17815.  L1003     /QUICKLIB, /EXEPACK incompatible
  17816.  
  17817.            You cannot link with both the /QU option and the /E option.
  17818.  
  17819.  L1004     option : invalid numeric value
  17820.  
  17821.            An incorrect value appeared for one of the linker options. For
  17822.            example, a character string was given for an option that requires
  17823.            a numeric value.
  17824.  
  17825.  L1005     /PACKCODE : packing limit exceeds 65536 bytes
  17826.  
  17827.            The value supplied with the /PACKCODE option exceeds the limit of
  17828.            65,536 bytes.
  17829.  
  17830.  L1006     option-text : stack size exceeds 65535 bytes
  17831.  
  17832.            The value given as a parameter to the /STACKSIZE option exceeds
  17833.            the maximum allowed.
  17834.  
  17835.  L1007     option : interrupt number exceeds 255
  17836.  
  17837.            A number greater than 255 was given as the /OVERLAYINTERRUPT
  17838.            option value.
  17839.  
  17840.  L1008     option : segment limit set too high
  17841.  
  17842.            The /SEGMENTS option specified a limit on the number of segments
  17843.            allowed greater than 3,072.
  17844.  
  17845.  L1009     number : CPARMAXALLOC : illegal value
  17846.  
  17847.            The number specified in the /CPARMAXALLOC option was not in the
  17848.            range 1- 65,535.
  17849.  
  17850.  L1020     no object modules specified
  17851.  
  17852.            No object-file names were specified to the linker.
  17853.  
  17854.  L1021     cannot nest response files
  17855.  
  17856.            A response file occurred within a response file.
  17857.  
  17858.  L1022     response line too long
  17859.  
  17860.            A line in a response file was longer than 127 characters.
  17861.  
  17862.  L1023     terminated by user
  17863.  
  17864.            You entered CTRL+C.
  17865.  
  17866.  L1024     nested right parentheses
  17867.  
  17868.            The contents of an overlay were typed incorrectly on the command
  17869.            line.
  17870.  
  17871.  L1025     nested left parentheses
  17872.  
  17873.            The contents of an overlay were typed incorrectly on the command
  17874.            line.
  17875.  
  17876.  L1026     unmatched right parenthesis
  17877.  
  17878.            A right parenthesis was missing from the contents specification of
  17879.            an overlay on the command line.
  17880.  
  17881.  L1027     unmatched left parenthesis
  17882.  
  17883.            A left parenthesis was missing from the contents specification of
  17884.            an overlay on the command line.
  17885.  
  17886.  L1030     missing internal name
  17887.  
  17888.            An IMPORT statement specified an ordinal in the module-definition
  17889.            file without including the internal name of the routine. The name
  17890.            must be given if the import is by ordinal.
  17891.  
  17892.  L1031     module description redefined
  17893.  
  17894.            A DESCRIPTION statement in the module-definition file was
  17895.            specified more than once, a procedure that is not allowed.
  17896.  
  17897.  L1032     module name redefined
  17898.  
  17899.            The module name was specified more than once (via a NAME or
  17900.            LIBRARY statement), a procedure that is not allowed.
  17901.  
  17902.  L1040     too many exported entries
  17903.  
  17904.            The module-definition file exceeded the limit of 3,072 exported
  17905.            names.
  17906.  
  17907.  L1041     resident-name table overflow
  17908.  
  17909.            The size of the resident-name table exceeds 65,534 bytes. (An
  17910.            entry in the resident-name table is made for each exported routine
  17911.            designated RESIDENTNAME, and consists of the name plus three bytes
  17912.            of information. The first entry is the module name.)
  17913.  
  17914.            Reduce the number of exported routines or change some to
  17915.            nonresident status.
  17916.  
  17917.  L1042     nonresident-name table overflow
  17918.  
  17919.            The size of the nonresident-name table exceeds 65,534 bytes. (An
  17920.            entry in the nonresident-name table is made for each exported
  17921.            routine not designated RESIDENT-NAME, and consists of the name
  17922.            plus three bytes of information. The first entry is the
  17923.            DESCRIPTION statement.)
  17924.  
  17925.            Reduce the number of exported routines or change some to resident
  17926.            status.
  17927.  
  17928.  L1043     relocation table overflow
  17929.  
  17930.            More than 32,768 long calls, long jumps, or other long pointers
  17931.            appeared in the program.
  17932.  
  17933.            Try replacing long references with short references where
  17934.            possible, and recreate the object module.
  17935.  
  17936.  L1044     imported-name table overflow
  17937.  
  17938.            The size of the imported-names table exceeds 65,534 bytes. (An
  17939.            entry in the imported-names table is made for each new name given
  17940.            in the IMPORTS section──including the module names──and consists
  17941.            of the name plus one byte.)
  17942.  
  17943.            Reduce the number of imports.
  17944.  
  17945.  L1045     too many TYPDEF records
  17946.  
  17947.            An object module contained more than 255 TYPDEF records. These
  17948.            records describe communal variables. This error can appear only
  17949.            with programs produced by the Microsoft FORTRAN Compiler or other
  17950.            compilers that support communal variables. (TYPDEF is a DOS term.
  17951.            It is explained in the Microsoft MS-DOS Programmer's Reference and
  17952.            in other reference books on DOS.)
  17953.  
  17954.  L1046     too many external symbols in one module
  17955.  
  17956.            An object module specified more than the limit of 1,023 external
  17957.            symbols.
  17958.  
  17959.            Break the module into smaller parts.
  17960.  
  17961.  L1047     too many group, segment, and class names in one module
  17962.  
  17963.            The program contained too many group, segment, and class names.
  17964.  
  17965.            Reduce the number of groups, segments, or classes, and recreate
  17966.            the object file.
  17967.  
  17968.  L1048     too many segments in one module
  17969.  
  17970.            An object module had more than 255 segments.
  17971.  
  17972.            Split the module or combine segments.
  17973.  
  17974.  L1049     too many segments
  17975.  
  17976.            The program had more than the maximum number of segments. (The
  17977.            /SEGMENTS option specifies the maximum legal number; the default
  17978.            is 128.)
  17979.  
  17980.            Relink by using the /SEGMENTS option with an appropriate number of
  17981.            segments.
  17982.  
  17983.  L1050     too many groups in one module
  17984.  
  17985.            LINK encountered more than 21 group definitions (GRPDEF) in a
  17986.            single module.
  17987.  
  17988.            Reduce the number of group definitions or split the module. (Group
  17989.            definitions are explained in the Microsoft MS-DOS Programmer's
  17990.            Reference and in other reference books on DOS.)
  17991.  
  17992.  L1051     too many groups
  17993.  
  17994.            The program defined more than 20 groups, not counting DGROUP.
  17995.  
  17996.            Reduce the number of groups.
  17997.  
  17998.  L1052     too many libraries
  17999.  
  18000.            An attempt was made to link with more than 32 libraries.
  18001.  
  18002.            Combine libraries, or use modules that require fewer libraries.
  18003.  
  18004.  L1053     out of memory for symbol table
  18005.  
  18006.            The program had more symbolic information (such as public,
  18007.            external, segment, group, class, and file names) than could fit in
  18008.            available memory.
  18009.  
  18010.            Try freeing memory by linking from the DOS command level instead
  18011.            of from a MAKE file or an editor. Otherwise, combine modules or
  18012.            segments and try to eliminate as many public symbols as possible.
  18013.  
  18014.  L1054     requested segment limit too high
  18015.  
  18016.            The linker did not have enough memory to allocate tables
  18017.            describing the num-ber of segments requested. (The default is 128
  18018.            or the value specified with the /SEGMENTS option.)
  18019.  
  18020.            Try linking again by using the /SEGMENTS option to select a
  18021.            smaller number of segments (for example, use 64 if the default was
  18022.            used previously), or free some memory by eliminating resident
  18023.            programs or shells.
  18024.  
  18025.  L1056     too many overlays
  18026.  
  18027.            The program defined more than 63 overlays.
  18028.  
  18029.  L1057     data record too large
  18030.  
  18031.            A LEDATA record (in an object module) contained more than 1,024
  18032.            bytes of data. This is a translator error. (LEDATA is a DOS term
  18033.            that is explained in the Microsoft MS-DOS Programmer's Reference
  18034.            and in other DOS reference books.)
  18035.  
  18036.            Note which translator (compiler or assembler) produced the
  18037.            incorrect object module and the circumstances. Please report this
  18038.            error to Microsoft Corporation by following the directions in the
  18039.            Microsoft Product Assistance Request form at the back of one of
  18040.            your manuals.
  18041.  
  18042.  L1061     out of memory for/INCREMENTAL
  18043.  
  18044.            The linker ran out of memory when trying to process the additional
  18045.            information required for ILINK support.
  18046.  
  18047.            Disable incremental linking.
  18048.  
  18049.  L1062     too many symbols for/INCREMENTAL
  18050.  
  18051.            The program had more symbols than can be stored in the .SYM file.
  18052.  
  18053.            Reduce the number of symbols or disable incremental linking.
  18054.  
  18055.  L1063     out of memory for CodeView information
  18056.  
  18057.            The linker was given too many object files with debug information,
  18058.            and the linker ran out of space to store it.
  18059.  
  18060.            Reduce the number of object files that have debug information.
  18061.  
  18062.  L1064     out of memory
  18063.  
  18064.            The linker was not able to allocate enough memory from the
  18065.            operating system to link the program. On OS/2, try increasing the
  18066.            swap space. Otherwise, reduce the size of the program in terms of
  18067.            code, data, and symbols. On OS/2, consider splitting the program
  18068.            into dynlink libraries.
  18069.  
  18070.  L1070     name : segment size exceeds 64K
  18071.  
  18072.            A single segment contained more than 64K of code or data.
  18073.  
  18074.            Try compiling and linking using the large model.
  18075.  
  18076.  L1071     segment _TEXT larger than 65520 bytes
  18077.  
  18078.            This error is likely to occur only in small-model C programs, but
  18079.            it can occur when any program with a segment named _TEXT is linked
  18080.            using the /DOSSEG option of the LINK command. Small-model C
  18081.            programs must reserve code addresses 0 and 1; this range is
  18082.            increased to 16 for alignment purposes.
  18083.  
  18084.            Try compiling and linking using the large model.
  18085.  
  18086.  L1072     common area longer than 65536 bytes
  18087.  
  18088.            The program had more than 64K of communal variables. This error
  18089.            cannot appear with object files generated by the Microsoft Macro
  18090.            Assembler, MASM. It occurs only with programs produced by the
  18091.            Microsoft FORTRAN Compiler or other compilers that support
  18092.            communal variables.
  18093.  
  18094.  L1073     file segment limit exceeded
  18095.  
  18096.            The number of physical or file segments exceeds the limit of 254
  18097.            imposed by OS/2 protected mode and by Windows for each application
  18098.            or dynamic-link library. (A file segment is created for each group
  18099.            definition, nonpacked logical segment, and set of packed
  18100.            segments.)
  18101.  
  18102.            Reduce the number of segments or put more information into each
  18103.            segment. Make sure that the /PACKCODE and/or the /PACKDATA options
  18104.            are on.
  18105.  
  18106.  L1074     name : group larger than 64K bytes
  18107.  
  18108.            The given group exceeds the limit of 65,536 bytes.
  18109.  
  18110.            Reduce the size of the group, or remove any unneeded segments from
  18111.            the group (refer to the map file for a listing of segments).
  18112.  
  18113.  L1075     entry table larger than 65535 bytes
  18114.  
  18115.            The entry table exceeds the limit of 65,535 bytes. (There is an
  18116.            entry in this table for each exported routine for each address
  18117.            that is the target of a far relocation, and for one of the
  18118.            following conditions when true: the target segment is
  18119.            designated IOPL; or PROTMODE is not enabled and the target segment
  18120.            is designated MOVABLE.)
  18121.  
  18122.            Declare PROTMODE if applicable, or reduce the number of exported
  18123.            routines, or make some segments FIXED or NOIOPL if possible.
  18124.  
  18125.  L1078     file segment alignment too small
  18126.  
  18127.            The segment-alignment size given with the /ALIGN:number option was
  18128.            too small. Try increasing number.
  18129.  
  18130.  L1080     cannot open list file
  18131.  
  18132.            The disk or the root directory was full.
  18133.  
  18134.            Delete or move files to make space.
  18135.  
  18136.  L1081     out of space for run file
  18137.  
  18138.            The disk on which the .EXE file was being written was full.
  18139.  
  18140.            Free more space on the disk and restart the linker.
  18141.  
  18142.  L1082     name : stub file not found
  18143.  
  18144.            The linker could not open the file given in the STUB statement in
  18145.            the module-definition file.
  18146.  
  18147.  L1083     cannot open run file
  18148.  
  18149.            The disk or the root directory was full.
  18150.  
  18151.            Delete or move files to make space.
  18152.  
  18153.  L1084     cannot create temporary file
  18154.  
  18155.            The disk or root directory was full.
  18156.  
  18157.            Free more space in the directory and restart the linker.
  18158.  
  18159.  L1085     cannot open temporary file
  18160.  
  18161.            The disk or the root directory was full.
  18162.  
  18163.            Delete or move files to make space.
  18164.  
  18165.  L1086     scratch file missing
  18166.  
  18167.            An internal error has occurred.
  18168.  
  18169.            Note the circumstances of the problem and contact Microsoft
  18170.            Corporation by following the directions in the Microsoft Product
  18171.            Assistance Request form at the back of one of your manuals.
  18172.  
  18173.  L1087     unexpected end-of-file on scratch file
  18174.  
  18175.            The disk with the temporary linker-output file was removed.
  18176.  
  18177.  L1088     out of space for list file
  18178.  
  18179.            The disk (where the listing file was being written) is full.
  18180.  
  18181.            Free more space on the disk and restart the linker.
  18182.  
  18183.  L1089     filename : cannot open response file
  18184.  
  18185.            LINK could not find the specified response file.
  18186.  
  18187.            This usually indicates a typing error.
  18188.  
  18189.  L1090     cannot reopen list file
  18190.  
  18191.            The original disk was not replaced at the prompt.
  18192.  
  18193.            Restart the linker.
  18194.  
  18195.  L1091     unexpected end-of-file on library
  18196.  
  18197.            The disk containing the library was probably removed.
  18198.  
  18199.            Replace the disk containing the library and run the linker again.
  18200.  
  18201.  L1092     cannot open module-definitions file
  18202.  
  18203.            The linker could not open the module-definition file specified on
  18204.            the command line or in the response file.
  18205.  
  18206.  L1093     filename : object not found
  18207.  
  18208.            One of the object files specified in the linker input was not
  18209.            found.
  18210.  
  18211.            Restart the linker and specify the object file.
  18212.  
  18213.  L1094     file : cannot open file for writing
  18214.  
  18215.            The linker was unable to open the file with write permission.
  18216.  
  18217.            Check file permissions.
  18218.  
  18219.  L1095     file : out of space on file
  18220.  
  18221.            The linker ran out of disk space for the specified output file.
  18222.  
  18223.            Delete or move files to make space.
  18224.  
  18225.  L1100     stub.EXE file invalid
  18226.  
  18227.            The file specified in the STUB statement is not a valid real-mode
  18228.            executable file.
  18229.  
  18230.  L1101     invalid object module
  18231.  
  18232.            One of the object modules was invalid.
  18233.  
  18234.            If the error persists after recompiling, please contact Microsoft
  18235.            Corporation by following the directions in the Microsoft Product
  18236.            Assistance Request form at the back of one of your manuals.
  18237.  
  18238.  L1102     unexpected end-of-file
  18239.  
  18240.            An invalid format for a library was encountered.
  18241.  
  18242.  L1103     attempt to access data outside segment bounds
  18243.  
  18244.            A data record in an object module specified data extending beyond
  18245.            the end of a segment. This is a translator error.
  18246.  
  18247.            Note which translator (compiler or assembler) produced the
  18248.            incorrect object module and the circumstances in which it was
  18249.            produced. Please report this error to Microsoft Corporation by
  18250.            following the directions in the Microsoft Product Assistance
  18251.            Request form at the back of one of your manuals.
  18252.  
  18253.  L1104     filename : not valid library
  18254.  
  18255.            The specified file was not a valid library file. This error causes
  18256.            LINK to abort.
  18257.  
  18258.  L1105     invalid object due to aborted incremental compile
  18259.  
  18260.            Delete the object file, recompile the program, and relink.
  18261.  
  18262.  L1113     unresolved COMDEF; internal error
  18263.  
  18264.            Note the circumstances of the error and contact Microsoft
  18265.            Corporation by following the directions in the Microsoft Product
  18266.            Assistance Request form at the back of one of your manuals.
  18267.  
  18268.  L1114     file not suitable for /EXEPACK; relink without
  18269.  
  18270.            For the linked program, the size of the packed load image plus
  18271.            packing overhead was larger than that of the unpacked load image.
  18272.  
  18273.            Relink without the /EXEPACK option.
  18274.  
  18275.  L1115     option: option incompatible with overlays
  18276.  
  18277.            The given option is not compatible with overlays. Remove the
  18278.            option or else do not use overlaid modules.
  18279.  
  18280.  L1123     name : segment defined for both 16- and 32-bit.
  18281.  
  18282.            Define the segment as either 16-bit or 32-bit.
  18283.  
  18284.  L1126     conflicting iopl-parameter-words value
  18285.  
  18286.            An exported name was specified in the module-definition file with
  18287.            an IOPL-parameter-words value, and the same name was specified as
  18288.            an export by the Microsoft C export pragma with a different
  18289.            parameter-words value.
  18290.  
  18291.  L1127     far segment references not allowed with /BINARY
  18292.  
  18293.            You used the /BINARY option (causing the linker to produce a .COM
  18294.            file) with modules that have a far segment reference. Far segment
  18295.            references are not compatible with the .COM file format.
  18296.            High-level-language modules cause this error message (unless the
  18297.            language supports tiny memory model). Assembly code that
  18298.            references a segment address also produces this error message. For
  18299.            example:
  18300.  
  18301.            mov     ax, seg mydata
  18302.  
  18303.  
  18304.  C.2.2  LINK Nonfatal Error Messages
  18305.  
  18306.  L2000     imported starting address
  18307.  
  18308.            The program starting address as specified in the END statement in
  18309.            a MASM file is an imported routine. This is not supported by OS/2
  18310.            or Windows.
  18311.  
  18312.  L2001     fixup(s) without data
  18313.  
  18314.            A FIXUPP record occurred without a data record immediately
  18315.            preceding it. This is probably a compiler error. (See the
  18316.            Microsoft MS-DOS Programmer's Reference for more information on
  18317.            FIXUPP.)
  18318.  
  18319.            If the error persists after recompiling, please contact Microsoft
  18320.            Corporation by following the directions in the Microsoft Product
  18321.            Assistance Request form at the back of one or your manuals.
  18322.  
  18323.  L2002     fixup overflow at number in segment name
  18324.  
  18325.            This error message will be followed by one of the following:
  18326.  
  18327.            1. "Target external 'name.'"
  18328.  
  18329.            2. frm seg name1, tgt seg name2, tgt offset number.
  18330.  
  18331.  A fixup overflow is essentially an attempted reference to code or data that
  18332.  is impossible because the source location, i.e., where the reference is made
  18333.  "from," and the target address, i.e., where the reference is made "to," are
  18334.  too far apart. A close look at the source location is often all you need to
  18335.  correct the problem.
  18336.  
  18337.  Revise the source file and recreate the object file. (For information about
  18338.  frame and target segments, see the Microsoft MS-DOS Programmer's Reference.)
  18339.  
  18340.  L2003     intersegment self-relative fixup at number in segment name
  18341.  
  18342.            The program issued a near call or jump to a label in a different
  18343.            segment. This error most often occurs when you specifically
  18344.            declare an external procedure to be near and it should be declared
  18345.            as far.
  18346.  
  18347.  L2004     LOBYTE-type fixup overflow
  18348.  
  18349.            A LOBYTE fixup generated an address overflow. (See the Microsoft
  18350.            MS-DOS Programmer's Reference for more information.)
  18351.  
  18352.  L2005     fixup type unsupported
  18353.  
  18354.            A fixup type occurred that is not supported by the Microsoft
  18355.            linker. This is probably a compiler error.
  18356.  
  18357.            Note the circumstances of the failure and contact Microsoft
  18358.            Corporation by following the directions in the Microsoft Product
  18359.            Assistance Request form at the back of one of your manuals.
  18360.  
  18361.  L2010     too many fixups in LIDATA record
  18362.  
  18363.            The number of far relocations (pointer- or base-type) in a LIDATA
  18364.            record ex- ceeds the limit imposed by the linker. This is
  18365.            typically produced by the DUP statement in an .ASM file. The limit
  18366.            is dynamic: a 1,024-byte buffer is shared by relocations and the
  18367.            contents of the LIDATA record; there are eight bytes per
  18368.            relocation.
  18369.  
  18370.            Reduce the number of far relocations in the DUP statement.
  18371.  
  18372.  L2011     name : NEAR/HUGE conflict
  18373.  
  18374.            Conflicting NEAR and HUGE attributes were given for a communal
  18375.            variable. This error can occur only with programs produced by the
  18376.            Microsoft FORTRAN Compiler or other compilers that support
  18377.            communal variables.
  18378.  
  18379.  L2012     name : array-element size mismatch
  18380.  
  18381.            A far communal array was declared with two or more different
  18382.            array-element sizes (for instance, an array was declared once as
  18383.            an array of characters and once as an array of real numbers). This
  18384.            error cannot occur with object files produced by the Microsoft
  18385.            Macro Assembler. It occurs only with the Microsoft FORTRAN
  18386.            Compiler and any other compiler that supports far communal arrays.
  18387.  
  18388.  L2013     LIDATA record too large
  18389.  
  18390.            A LIDATA record contained more than 512 bytes. This is probably a
  18391.            compiler error.
  18392.  
  18393.            Note the circumstances of the failure and contact Microsoft
  18394.            Corporation by following the directions in the Microsoft Product
  18395.            Assistance Request form at the back of one of your manuals.
  18396.  
  18397.  L2022     name (alias internalname) : export undefined
  18398.  
  18399.            The internal name of the given exported routine is undefined.
  18400.  
  18401.            Number LINK Error Message
  18402.  
  18403.  L2023     name (alias internalname) : export imported
  18404.  
  18405.            The internal name of the given exported routine conflicts with the
  18406.            internal name of a previously imported routine.  The set of
  18407.            imported and exported names cannot overlap.
  18408.  
  18409.  L2024     name : special symbol already defined
  18410.  
  18411.            Your program defined a symbol name already used by the linker for
  18412.            one of its own low-level symbols. (For example, the linker
  18413.            generates special symbols used in overlay support and other
  18414.            operations.)
  18415.  
  18416.            Choose another name for the symbol in order to avoid conflict.
  18417.  
  18418.  L2025     name : symbol defined more than once.
  18419.  
  18420.            The same symbol has been found in two different object files.
  18421.  
  18422.  L2026     entry ordinal number, name name : multiple definitions for the
  18423.            same ordinal
  18424.  
  18425.            The given exported name with the given ordinal number conflicted
  18426.            with a different exported name previously assigned to the same
  18427.            ordinal. Only one name can be associated with a particular
  18428.            ordinal.
  18429.  
  18430.  L2027     name : ordinal too large for export
  18431.  
  18432.            The given exported name was assigned an ordinal that exceeded the
  18433.            limit of 3,072.
  18434.  
  18435.  L2028     automatic data segment plus heap exceed 64K
  18436.  
  18437.            The total size of data declared in DGROUP, plus the value given in
  18438.            HEAPSIZE in the module-definition file, plus the stack size given
  18439.            by the /STACKSIZE option or STACKSIZE module-definition file
  18440.            statement, exceeds 64K.  Reduce near-data allocation, HEAPSIZE, or
  18441.            stack.
  18442.  
  18443.  L2029     name : unresolved external
  18444.  
  18445.            The name that comes before in file(s) is the unresolved external
  18446.            symbol. On the next line is a list of object modules that have
  18447.            made references to this symbol. This message and the list are also
  18448.            written to the map file, if one exists.
  18449.  
  18450.  L2030     starting address not code (use class 'CODE')
  18451.  
  18452.            The program starting address, as specified in the END statement of
  18453.            an .ASM file, should be in a code segment. (Code segments are
  18454.            recognized if their class name ends in 'CODE'.) This is an error
  18455.            in OS/2 protected mode.
  18456.  
  18457.            The error message may be disabled by including the REALMODE
  18458.            statement in the module-definition file.
  18459.  
  18460.  L2041     stack plus data exceed 64K
  18461.  
  18462.            If the total of near data and requested stack size exceeds 64K,
  18463.            the program will not run correctly. The linker checks for this
  18464.            condition only when /DOSSEG is enabled, which is the case in the
  18465.            library startup module.
  18466.  
  18467.            Reduce the stack size.
  18468.  
  18469.  L2043     Quick Library support module missing
  18470.  
  18471.            You did not link with the required QUICKLIB.OBJ module when
  18472.            creating a Quick library.
  18473.  
  18474.  L2044     name : symbol multiply defined, use/NOE
  18475.  
  18476.            The linker found what it interprets as a public-symbol
  18477.            redefinition, probably because you have redefined a symbol defined
  18478.            in a library. Relink with the /NOEXTDICTIONARY (NOE) option. If
  18479.            error L2025 results for the same symbol, then you have a genuine
  18480.            symbol-redefinition error.
  18481.  
  18482.  L2045     segmentname : segment with > 1 class name not allowed with/INC
  18483.  
  18484.            Your program defined a segment more than once, giving the segment
  18485.            different class names. Different class names for the same segment
  18486.            are not allowed when you link with the /INCREMENTAL option.
  18487.            Normally, this error should never appear unless you are
  18488.            programming with MASM. For example, if you give the two MASM
  18489.            statements
  18490.  
  18491.            _BSS segment
  18492.            'BSS'_BSS segment 'DATA'
  18493.  
  18494.            then the statements have the effect of defining two distinct
  18495.            segments with the same name but different classes. This situation
  18496.            is incompatible with the /INCREMENTAL option.
  18497.  
  18498.  L2047     IOPL attribute conflict - segment: segname in group: grpname
  18499.  
  18500.            The segment segname is the a member of the group grpname, but has
  18501.            a different IOPL attribute from other segments in the group.
  18502.  
  18503.  
  18504.  C.2.3  LINK Warning Messages
  18505.  
  18506.  L4000     seg disp. included near offset in segment name
  18507.  
  18508.            This is the warning generated by the /WARNFIXUP option. See
  18509.            Section 13.3.31, "Issuing Fixup Warnings," for more information
  18510.            on that option.
  18511.  
  18512.  L4001     frame-relative fixup, frame ignored near offset in segment name
  18513.  
  18514.            A reference is made relative to a segment that is different from
  18515.            the target segment of the reference. For example, if _foo is
  18516.            defined in segment _TEXT, the instruction call DGROUP:_foo
  18517.            produces this warning. The frame DGROUP is ignored, so the linker
  18518.            treats the call as if it were call _TEXT:_foo.
  18519.  
  18520.  L4002     frame-relative absolute fixup near offset in segment name
  18521.  
  18522.            A reference is made similar to the type described in L4001, but
  18523.            both segments are absolute (defined with AT). The linker treats
  18524.            the executable file as if the file were to run in real mode only.
  18525.  
  18526.  L4003     intersegment self-relative fixup at offset in segment name pos:
  18527.            offset target external 'name'
  18528.  
  18529.            The linker found an intersegment self-relative fixup. This error
  18530.            may be caused by compiling a small-model program with the /NT
  18531.            option.
  18532.  
  18533.  L4010     invalid alignment specification
  18534.  
  18535.            The number specified in the /ALIGNMENT option must be a power of 2
  18536.            in the range 2-32,768, inclusive.
  18537.  
  18538.  L4011     PACKCODE value exceeding 65500 unreliable
  18539.  
  18540.            The packing limit specified with the /PACKCODE option was between
  18541.            65,500 and 65,536. Code segments with a size in this range are
  18542.            unreliable on some steppings of the 80286 processor.
  18543.  
  18544.  L4012     load-high disables EXEPACK
  18545.  
  18546.            The /HIGH and /EXEPACK options cannot be used at the same time.
  18547.  
  18548.  L4013     invalid option for new-format executable file ignored
  18549.  
  18550.            The use of overlays with the options /CPARMAXALLOC, /DSALLOCATE,
  18551.            and /NOGROUPASSOCIATION is not allowed with either OS/2
  18552.            protected-mode or Windows executable files.
  18553.  
  18554.  L4014     option : invalid option for old-format executable file ignored
  18555.  
  18556.            The /ALIGNMENT option is invalid for real-mode executables.
  18557.  
  18558.  L4015     /CODEVIEW disables /DSALLOCATE
  18559.  
  18560.            The /CODEVIEW and /DSALLOCATE options cannot be used at the same
  18561.            time.
  18562.  
  18563.  L4016     /CODEVIEW disables/EXEPACK
  18564.  
  18565.            The /CODEVIEW and /EXEPACK options cannot be used at the same
  18566.            time.
  18567.  
  18568.  L4020     name : code-segment size exceeds 65500
  18569.  
  18570.            Code segments of 65,501-65,536 bytes in length may be unreliable
  18571.            on the Intel 80286 processor.
  18572.  
  18573.  L4021     no stack segment
  18574.  
  18575.            The program did not contain a stack segment defined with STACK
  18576.            combine type. This message should not appear for modules compiled
  18577.            with the Microsoft FORTRAN Compiler, but it could appear for an
  18578.            assembly-language module.
  18579.  
  18580.            Normally, every program should have a stack segment with the
  18581.            combine type specified as STACK. You may ignore this message if
  18582.            you have a specific reason for not defining a stack or for
  18583.            defining one without the STACK combine type. Linking with versions
  18584.            of LINK earlier than Version 2.40 might cause this message since
  18585.            these linkers search libraries only once.
  18586.  
  18587.  L4022     group1, group2 : groups overlap
  18588.  
  18589.            The named groups overlap. Since a group is assigned to a physical
  18590.            segment, groups cannot overlap with either OS/2 protected-mode or
  18591.            Windows executable files.
  18592.  
  18593.            Reorganize segments and group definitions so the groups do not
  18594.            overlap. Refer to the map file.
  18595.  
  18596.  L4023     name (internal name) : export internal name conflict
  18597.  
  18598.            The internal name of the given exported routine conflicted with
  18599.            the internal name of a previous import definition or export
  18600.            definition.
  18601.  
  18602.  L4024     name : multiple definitions for export name
  18603.  
  18604.            The given name was exported more than once, an action that is not
  18605.            allowed.
  18606.  
  18607.  L4025     name : import internal name conflict
  18608.  
  18609.            The internal name of the given imported routine (import is either
  18610.            a name or a number) conflicted with the internal name of a
  18611.            previous export or import.
  18612.  
  18613.  L4026     dynlib.import (name) : self-imported
  18614.  
  18615.            The given imported routine was imported from the module being
  18616.            linked. This is not supported on some systems.
  18617.  
  18618.  L4027     name : multiple definitions for import internal-name
  18619.  
  18620.            The given internal name was imported more than once. Previous
  18621.            import definitions are ignored.
  18622.  
  18623.  L4028     name : segment already defined
  18624.  
  18625.            The given segment was defined more than once in the SEGMENTS
  18626.            statement of the module-definition file.
  18627.  
  18628.  L4029     name : DGROUP segment converted to type data
  18629.  
  18630.            The given logical segment in the group DGROUP was defined as a
  18631.            code segment. (DGROUP cannot contain code segments because the
  18632.            linker always considers DGROUP to be a data segment. The name
  18633.            DGROUP is predefined as the automatic data segment.) The linker
  18634.            converts the named segment to type "data."
  18635.  
  18636.  L4030     name : segment attributes changed to conform with automatic data
  18637.            segment
  18638.  
  18639.            The given logical segment in the group DGROUP was given sharing
  18640.            attributes (SHARED/NONSHARED) that differed from the automatic
  18641.            data attributes as declared by the DATA instance specification
  18642.            (SINGLE/MULTIPLE). The attributes are converted to conform to
  18643.            those of DGROUP. Refer to Error L4029 for more information on
  18644.            DGROUP.
  18645.  
  18646.  L4031     name : segment declared in more than one group
  18647.  
  18648.            A segment was declared to be a member of two different groups.
  18649.  
  18650.            Correct the source file and recreate the object files.
  18651.  
  18652.  L4032     name : code-group size exceeds 65500 bytes
  18653.  
  18654.            The given code group has a size between 65,500 and 65,536 bytes, a
  18655.            size that is unreliable on some steppings of the 80286 processor.
  18656.  
  18657.  L4034     more than 239 overlay segments; extra put in root
  18658.  
  18659.            Your program designated more than the limit of 239 segments to go
  18660.            in overlays. Starting with the 234th segment, they are assigned to
  18661.            the root (that is, the permanently resident portion of the
  18662.            program).
  18663.  
  18664.  L4036     no automatic data segment
  18665.  
  18666.            The application did not define a group named DGROUP. DGROUP has
  18667.            special meaning to the linker, which uses it to identify the
  18668.            automatic or default data segment used by the operating system.
  18669.            Most OS/2 protected-mode and Windows applications require DGROUP.
  18670.            This warning will not be issued if DATA NONE is declared or if the
  18671.            executable file is a dynamic-link library.
  18672.  
  18673.  L4038     program has no starting address
  18674.  
  18675.            Your OS/2 or Windows application had no starting address, which
  18676.            usually will cause the program to fail. Higher-level languages
  18677.            automatically specify a starting address. If you are writing an
  18678.            assembly-language program, specify a starting address with the END
  18679.            statement.
  18680.  
  18681.            Real-mode programs and dynamic-link libraries should never receive
  18682.            this message, regardless whether or not they have starting
  18683.            addresses.
  18684.  
  18685.  L4042     cannot open old version
  18686.  
  18687.            The file specified in the OLD statement in the module-definition
  18688.            file could not be opened.
  18689.  
  18690.  L4043     old version not segmented-executable format
  18691.  
  18692.            The file specified in the OLD statement in the module-definition
  18693.            file was not a valid OS/2 protected-mode or Windows executable
  18694.            file.
  18695.  
  18696.  L4045     name of output file is name
  18697.  
  18698.            The prompt for the run-file field gave an inaccurate default
  18699.            because /QUICKLIB option was not used early enough. The output
  18700.            will be a Quick library with the name given in the error message.
  18701.  
  18702.  L4046     module name different from output file name
  18703.  
  18704.            The name of the executable file as specified in the NAME or
  18705.            LIBRARY statement is different from the output file name. This may
  18706.            cause problems; consult the documentation for your operating
  18707.            system.
  18708.  
  18709.  L4050     too many public symbols for sorting
  18710.  
  18711.            The linker uses the stack and all available memory in the near
  18712.            heap to sort public symbols for the /MAP option. If the number of
  18713.            public symbols exceeds the space available for them, this warning
  18714.            is issued and the symbols are not sorted in the map file but
  18715.            listed in an arbitrary order.
  18716.  
  18717.            Reduce the number of symbols.
  18718.  
  18719.  L4051     filename : cannot find library
  18720.  
  18721.            The linker could not find the specified file.
  18722.  
  18723.            Enter a new file name, a new path specification, or both.
  18724.  
  18725.  L4053     VM.TMP : illegal file name; ignored
  18726.  
  18727.            VM.TMP appeared as an object-file name.
  18728.  
  18729.            Rename the file and rerun the linker.
  18730.  
  18731.  L4054     filename : cannot find file
  18732.  
  18733.            The linker could not find the specified file.
  18734.  
  18735.            Enter a new file name, a new path specification, or both.
  18736.  
  18737.  L4067     ignoring start address not equal to 0x100 for /TINY
  18738.  
  18739.            The code specified a starting address other than the assumed
  18740.            address of 100 hex for a .COM file created with the /TINY option.
  18741.            The linker is proceeding to start the .COM file at 100 hex,
  18742.            regardless of the specified address.
  18743.  
  18744.            Present only in the DOS-only 3.xx linkers and the executable 5.xx
  18745.            linkers.
  18746.  
  18747.  
  18748.  C.3  ILINK Error Messages
  18749.  
  18750.  This section lists and describes error messages generated by the Microsoft
  18751.  Incremental Linker, ILINK.
  18752.  
  18753.  Fatal errors cause the linker to end the linking session. Fatal error
  18754.  messages have the following format:
  18755.  
  18756.  location : error L1xxx: messagetext
  18757.  
  18758.  Incremental violations cause ILINK to end the linking session and carry out
  18759.  the command specified by the /e option.  Incremental violations messages
  18760.  have the following format:
  18761.  
  18762.  location : error L2xxx: messagetext
  18763.  
  18764.  Warnings give notice of certain conditions without ending the operation of
  18765.  ILINK. Warnings have the following format:
  18766.  
  18767.  location : warning L4xxx: messagetext
  18768.  
  18769.  In all three kinds of messages, location is the input file associated with
  18770.  the error. If the input file is an .OBJ or .LIB file and has a module name,
  18771.  the module name is enclosed in parentheses, as shown in the following
  18772.  examples:
  18773.  
  18774.       SLIBC.LIB (_file)
  18775.       MAIN.OBJ (main.c)
  18776.       TEXT.OBJ
  18777.  
  18778.  The following error messages may appear when you link object files with the
  18779.  Microsoft Incremental Linker, ILINK.
  18780.  
  18781.  
  18782.  C.3.1  ILINK Fatal Errors
  18783.  
  18784.  L1105     invalid object due to aborted incremental compile
  18785.  
  18786.            Delete the object file, recompile the program, and relink.
  18787.  
  18788.  L1200     .SYM seek error
  18789.  
  18790.            The .SYM file could not be properly read. Try redoing a full link
  18791.            with the /INCREMENTAL option.
  18792.  
  18793.  L1201     .SYM read error
  18794.  
  18795.            The .SYM file could not be properly read. Try redoing a full link
  18796.            with the /INCREMENTAL option.
  18797.  
  18798.  L1202     .SYM write error
  18799.  
  18800.            The disk is full or the .SYM file already exists and has the
  18801.            READONLY attribute.
  18802.  
  18803.  L1203     map for segment name exceeds 64K
  18804.  
  18805.            The symbolic information associated with the given segment exceeds
  18806.            64K bytes, an amount more than ILINK can handle.
  18807.  
  18808.  L1204     .ILK write error
  18809.  
  18810.            The disk is full or the .SYM file already exists and has the
  18811.            READONLY attribute.
  18812.  
  18813.  L1205     fixup overflow at address in segment name
  18814.  
  18815.            A FIXUPP object record with the given location referred to a
  18816.            target too far away to be correctly processed. This messages
  18817.            indicates an error in translation by the compiler or assembler.
  18818.  
  18819.  L1206     .ILK seek error
  18820.  
  18821.            The .ILK file is corrupted. Do a full link. If the error
  18822.            persists, note the circumstance of the error and notify Microsoft
  18823.            Corporation by following the directions in the Microsoft Product
  18824.            Assistance Request form at the back of one of your manuals.
  18825.  
  18826.  L1207     .ILK file too large
  18827.  
  18828.            The .ILK file is too large for ILINK to process. Do a full link.
  18829.  
  18830.  L1208     invalid .SYM file
  18831.  
  18832.            The .SYM file is invalid; delete the file and do a full link. If
  18833.            the problem persists, contact Microsoft Product Support.
  18834.  
  18835.  L1209     .OBJ close error
  18836.  
  18837.            The operating system returned an error when ILINK attempted to
  18838.            close one of the .OBJ files.
  18839.  
  18840.  L1210     .OBJ read error
  18841.  
  18842.            The .OBJ file has an unreadable structure. Try rebuilding the .OBJ
  18843.            file and doing a full link. This message indicates an error in
  18844.            translation by the compiler or assembler.
  18845.  
  18846.  L1211     too many LNAMES
  18847.  
  18848.            An object module has more than 255 LNAME records.
  18849.  
  18850.  L1212     too many SEGDEFs
  18851.  
  18852.            The given object module has more than 100 SEGDEF records. A SEGDEF
  18853.            record defines logical segments.
  18854.  
  18855.  L1213     too many GRPDEFs
  18856.  
  18857.            The given object module has more than 10 GRPDEF records. A GRPDEF
  18858.            record defines physical segments.
  18859.  
  18860.  L1214     too many COMDEFs
  18861.  
  18862.            The total number of COMDEF and EXTDEF records exceeded the limit.
  18863.            The limit on the total of COMDEF records (communal data variables)
  18864.            and EXTDEF records (external references) is 1,023. Use fewer
  18865.            communal or external variables in your program.
  18866.  
  18867.  L1215     too many EXTDEFs
  18868.  
  18869.            The total number of COMDEF and EXTDEF records exceeded the limit.
  18870.            The limit on the total of COMDEF records (communal data variables)
  18871.            and EXTDEF records (external references) is 1,023. Use fewer
  18872.            communal or external variables in your program.
  18873.  
  18874.  L1216     symbol name multiply defined
  18875.  
  18876.            The given symbol is defined more than once.
  18877.  
  18878.  L1217     internal error #3
  18879.  
  18880.            Note the circumstance of the error and notify Microsoft
  18881.            Corporation by following the directions in the Microsoft Product
  18882.            Assistance Request form at the back of one of your manuals.
  18883.  
  18884.  L1218     .EXE file too big, change alignment
  18885.  
  18886.            The segment-sector alignment value in the .EXE file is too small
  18887.            to express the size of one of the segments.  Do a full link and
  18888.            increase the alignment value with the /ALIGNMENT option to LINK.
  18889.  
  18890.  L1219     too many library files
  18891.  
  18892.            The number of libraries exceeded ILINK's limit of 32 libraries
  18893.            (.LIB files). Reduce the number of libraries.
  18894.  
  18895.  L1220     seek error on library
  18896.  
  18897.            A library (.LIB file) is corrupted. Do a full link and check your
  18898.            .LIB files.
  18899.  
  18900.  L1221     library close error
  18901.  
  18902.            The operating system returned an error when ILINK attempted to
  18903.            close one of the libraries (.LIB files). Do a full link. If the
  18904.            error persists, note the circumstances of the error and notify
  18905.            Microsoft Corporation by following the directions in the Microsoft
  18906.            Product Assistance Request form at the back of one of your
  18907.            manuals.
  18908.  
  18909.  L1222     error closing .EXE file
  18910.  
  18911.            The operating system returned an error when ILINK attempted to
  18912.            close the executable file. Do a full link. If the error persists,
  18913.            contact Microsoft Product Support.
  18914.  
  18915.  L1223     could not update time on file
  18916.  
  18917.            The operating system returned an error when ILINK attempted to
  18918.            update the time on the given file. Possibly the file had the
  18919.            READONLY attribute set.
  18920.  
  18921.  L1224     invalid flag character
  18922.  
  18923.            You used incorrect syntax on the ILINK command line.
  18924.  
  18925.  L1225     only one -e command allowed
  18926.  
  18927.            You used incorrect syntax on the ILINK command line.
  18928.  
  18929.  L1226     terminated by user
  18930.  
  18931.            You pressed CTRL+C or CTRL+BREAK, an action that interrupts and
  18932.            terminates ILINK.
  18933.  
  18934.  L1227     file name write protected
  18935.  
  18936.            The .EXE, .ILK, or .SYM file that ILINK attempted to update has
  18937.            the READONLY attribute.
  18938.  
  18939.  L1228     file name missing
  18940.  
  18941.            ILINK could not find one of the .OBJ files specified on the
  18942.            command line.
  18943.  
  18944.  L1229     invalid.OBJ format
  18945.  
  18946.            There may be one of several problems: error in compiler
  18947.            translation, corrupted object file, invalid object file (possibly
  18948.            text file), or object file could not be read or found.
  18949.  
  18950.  L1230     invalid file record: position = address
  18951.  
  18952.            The given .OBJ file has an invalid format or one unrecognized by
  18953.            ILINK. This message may indicate an error in translation by the
  18954.            compiler or assembler.
  18955.  
  18956.  L1231     file name was not full linked
  18957.  
  18958.            You specified an .OBJ file in the ILINK command line that was not
  18959.            in the list of files in the most recent full link.
  18960.  
  18961.  L1232     cannot run program
  18962.  
  18963.            ILINK is unable to execute a program specified for execution with
  18964.            the \e command-line option. Make sure the program is in the search
  18965.            path and is an .EXE or .COM file.
  18966.  
  18967.  L1233     program returned return-code
  18968.  
  18969.            The given program was specified with the \e option. When ILINK
  18970.            executed this program, it terminated with the given nonzero return
  18971.            code. ILINK cannot continue to the next commands, if any.
  18972.  
  18973.  L1234     error creating file
  18974.  
  18975.            ILINK was unable to create the batch file for executing the \e
  18976.            commands. Make sure the directory given in TMP or TEMP, or the
  18977.            current directory, exists and can be written to.
  18978.  
  18979.  L1235     error writing to file
  18980.  
  18981.            ILINK experienced an error while writing the batch file for
  18982.            executing the \e commands.  Make sure the drive for TMP or TEMP or
  18983.            the current drive has enough free space.
  18984.  
  18985.  L1240     far references in STRUC fields not supported
  18986.  
  18987.            ILINK currently does not support STRUC definitions like this:
  18988.  
  18989.                extrn   func:FAR
  18990.                rek     STRUC
  18991.                far_adr DD     func    ; Initialized far address
  18992.                                       ; within a STRUC
  18993.                rek     ENDS
  18994.  
  18995.            To use ILINK, change your code to get rid of the far address
  18996.            within the STRUC.
  18997.  
  18998.  L1241     too many defined segments
  18999.  
  19000.            ILINK has a limit of 255 physical segments (that is, segments
  19001.            defined in the object module as opposed to groups or logical
  19002.            segments). To use ILINK, reduce the number of segments.
  19003.  
  19004.  L1242     too many modules
  19005.  
  19006.            The program exceeds ILINK's limit of 1,204 modules. Reduce the
  19007.            number of modules.
  19008.  
  19009.  L1243     cannot link 64K-length segments
  19010.  
  19011.            The program has a segment larger than 65,535 bytes.
  19012.  
  19013.  L1244     cannot link iterated segments
  19014.  
  19015.            ILINK cannot handle programs linked with the /EXEPACK linker
  19016.            option.
  19017.  
  19018.  
  19019.  C.3.2  Incremental Violations
  19020.  
  19021.  L1250     number undefined symbols
  19022.  
  19023.            A number of symbols were referred to in fixups but never publicly
  19024.            defined in the program. The given number indicates how many of
  19025.            these undefined symbols were found.
  19026.  
  19027.  L1251     invalid module reference library
  19028.  
  19029.            The program makes a dynamic-link reference to a dynamic-link
  19030.            library that is not recognized or declared by the .EXE file.
  19031.  
  19032.  L1252     file name does not exist
  19033.  
  19034.            ILINK could not find the given file required for ILINK operation.
  19035.  
  19036.  L1253     symbol name deleted
  19037.  
  19038.            A symbol was deleted from an incrementally linked module.
  19039.  
  19040.  L1254     new segment definition name
  19041.  
  19042.            A segment was added to the program.
  19043.  
  19044.  L1255     changed segment definition name
  19045.  
  19046.            The segment contribution changed for the given module; it
  19047.            contributed to a segment it did not previously contribute to, or a
  19048.            segment contribution was removed.
  19049.  
  19050.  L1256     segment name grew too big
  19051.  
  19052.            The given segment grew beyond the padding for the given module.
  19053.  
  19054.  L1257     new group definition name
  19055.  
  19056.            A new group was defined via the GROUP directive in assembly
  19057.            language or via the \ND C compiler option.
  19058.  
  19059.  L1258     group name changed to include segment
  19060.  
  19061.            The list of segments included in the given group changed.
  19062.  
  19063.  L1259     symbol name changed
  19064.  
  19065.            The given data symbol moved (is now at a new address).
  19066.  
  19067.  L1260     cannot add new communal data symbol name
  19068.  
  19069.            A new communal data symbol was added as an uninitialized variable
  19070.            in C or with the COMM feature in MASM.
  19071.  
  19072.  L1261     communal variable name grew too big
  19073.  
  19074.            The given communal variable changed size too much.
  19075.  
  19076.  L1262     invalid symbol type for symbol
  19077.  
  19078.            A symbol which was previously a code symbol became a data symbol
  19079.            or vice versa.
  19080.  
  19081.  L1263     new Codeview symbolic info
  19082.  
  19083.            A module previously compiled without \Zi was compiled with \Zi.
  19084.  
  19085.  L1264     new line-number info
  19086.  
  19087.            A module previously compiled without \Zi or \Zd was compiled with
  19088.            \Zi or \Zd.
  19089.  
  19090.  L1265     new public CodeView info
  19091.  
  19092.            New information on public symbol addresses was added.
  19093.  
  19094.  L1266     invalid .EXE file
  19095.  
  19096.            The .EXE file is invalid. Make sure you are using an up-to-date
  19097.            linker. If the error persists, note the circumstances of the error
  19098.            and notify Microsoft Corporation by following the directions in
  19099.            the Microsoft Product Assistance Request form at the back of one
  19100.            of your manuals.
  19101.  
  19102.  L1267     invalid .ILK file
  19103.  
  19104.            The .ILK file is invalid. Make sure you are using an up-to-date
  19105.            linker. If the error persists, notify Microsoft Corporation by
  19106.            following the directions in the Microsoft Product Assistance
  19107.            Request form at the back of one of your manuals.
  19108.  
  19109.  L1268     .SYM/.ILK mismatch
  19110.  
  19111.            The .SYM and .ILK files are out of sync.  Make sure you are using
  19112.            an up-to-date linker. If the error persists, note the
  19113.            circumstances of the error and notify Microsoft Corporation by
  19114.            following the directions in the Microsoft Product Assistance
  19115.            Request form at the back of one of your manuals.
  19116.  
  19117.  L1269     library name has changed
  19118.  
  19119.            The given library has changed.
  19120.  
  19121.  L1270     entry table expansion not implemented
  19122.  
  19123.            The program call tree changed in such a way that ILINK could not
  19124.            process it correctly. This problem is caused by new calls to a
  19125.            routine from another routine that did not call it before. Do a
  19126.            full link.
  19127.  
  19128.  L1271     segment index with relocs exceeds 64K; cannot move
  19129.  
  19130.            The given segment, referred to by its index within the program's
  19131.            segment table, is too big along with its runtime relocations for
  19132.            ILINK to process the segment correctly.
  19133.  
  19134.  L1272     .ILK read error
  19135.  
  19136.            The .ILK file does not exist or was not in the expected format.
  19137.  
  19138.  L1273     out of memory
  19139.  
  19140.            ILINK ran out of memory for processing the input. If you are
  19141.            running ILINK while using the NMAKE utility, try running ILINK
  19142.            from the shell (that is, directly from the operating-system
  19143.            prompt). Otherwise, do a full link.
  19144.  
  19145.  
  19146.  C.3.3  ILINK Warning Messages
  19147.  
  19148.  L4201     fixup frame relative to an (as yet) undefined symbol - assuming
  19149.            ok
  19150.  
  19151.            See documentation for LINK error messages L4001 and L4002.
  19152.  
  19153.  L4202     module contains TYPEDEFs - ignored
  19154.  
  19155.            The .OBJ file contains type definitions. ILINK ignores these
  19156.            records.
  19157.  
  19158.  L4203     module contains BLKDEFs - ignored
  19159.  
  19160.            The .OBJ file contains records no longer supported by Microsoft
  19161.            language compilers.
  19162.  
  19163.  L4204     old .EXE free information lost
  19164.  
  19165.            The free list in the .EXE file has been corrupted. The free list
  19166.            represents "holes" in the EXE file made available when segments
  19167.            moved to new locations.
  19168.  
  19169.  L4205     file name has no useful contribution
  19170.  
  19171.            The given module makes no contribution to any segment.
  19172.  
  19173.  L4206     main entry point moved
  19174.  
  19175.            The program starting address changed. You may want to consider
  19176.            doing a full link.
  19177.  
  19178.  
  19179.  C.4  LIB Error Messages
  19180.  
  19181.  Error messages generated by the Microsoft Library Manager, LIB, have one of
  19182.  the following formats:
  19183.  
  19184.       {filename| LIB} : fatal error U1xxx: messagetext
  19185.       {filename| LIB} : nonfatal error U2xxx: messagetext
  19186.       {filename| LIB} : warning U4xxx: messagetext
  19187.  
  19188.  The message begins with the input-file name (filename), if one exists, or
  19189.  with the name of the utility. If possible, LIB prints a warning and
  19190.  continues operation. In some cases errors are fatal, and LIB terminates
  19191.  processing. LIB may display the following error messages.
  19192.  
  19193.  
  19194.  C.4.1  Fatal LIB Error Messages
  19195.  
  19196.  U1150     page size too small
  19197.  
  19198.            The page size of an input library was too small, indicating an
  19199.            invalid input .LIB file.
  19200.  
  19201.  U1151     syntax error : illegal file specification
  19202.  
  19203.            A command operator such as a minus sign (-) was given without a
  19204.            following module name.
  19205.  
  19206.  U1152     syntax error : option name missing
  19207.  
  19208.            A forward slash (/) was given without an option after it.
  19209.  
  19210.  U1153     syntax error : option value missing
  19211.  
  19212.            The /PAGESIZE option was given without a value following it.
  19213.  
  19214.  U1154     option unknown
  19215.  
  19216.            An unknown option was given. Currently, LIB recognizes the
  19217.            /PAGESIZE, /NOIGNORECASE, and /IGNORECASE options.
  19218.  
  19219.  U1155     syntax error : illegal input
  19220.  
  19221.            The given command did not follow correct LIB syntax as specified
  19222.            in Chapter 15, "Managing Libraries with LIB."
  19223.  
  19224.  U1156     syntax error
  19225.  
  19226.            The given command did not follow the correct LIB syntax as
  19227.            specified in Chapter 15, "Managing Libraries with LIB."
  19228.  
  19229.  U1157     comma or new line missing
  19230.  
  19231.            A comma or carriage return was expected in the command line but
  19232.            did not appear. This may indicate an incorrectly placed comma, as
  19233.            in the following line:
  19234.  
  19235.               LIB math.lib,-mod1+mod2;
  19236.  
  19237.            The line should have been entered as follows:
  19238.  
  19239.               LIB math.lib -mod1+mod2;
  19240.  
  19241.  U1158     terminator missing
  19242.  
  19243.            Either the response to the Output library prompt or the last line
  19244.            of the response file used to start LIB did not end with a carriage
  19245.            return.
  19246.  
  19247.  U1161     cannot rename old library
  19248.  
  19249.            LIB could not rename the old library to have a .BAK extension
  19250.            because the .BAK version already existed with read only
  19251.            protection.
  19252.  
  19253.            Change the protection on the old .BAK version.
  19254.  
  19255.  U1162     cannot reopen library
  19256.  
  19257.            The old library could not be reopened after it was renamed to have
  19258.            a .BAK extension.
  19259.  
  19260.  U1163     error writing to cross-reference file
  19261.  
  19262.            The disk or root directory was full.
  19263.  
  19264.            Delete or move files to make space.
  19265.  
  19266.  U1170     too many symbols
  19267.  
  19268.            More than 4,609 symbols appeared in the library file.
  19269.  
  19270.  U1171     insufficient memory
  19271.  
  19272.            LIB did not have enough memory to run.
  19273.  
  19274.            Remove any shells or resident programs and try again, or add more
  19275.            memory.
  19276.  
  19277.  U1172     no more virtual memory
  19278.  
  19279.            Try using the /NOEXTDICTIONARY. The current library exceeds the
  19280.            512K byte limit imposed by LIB option. Try using the
  19281.            /NOEXITDICTIONARY or reduce the number of object modules.
  19282.  
  19283.  U1173     internal failure
  19284.  
  19285.            Note the circumstances of the failure and notify Microsoft
  19286.            Corporation by following the directions in the Microsoft Product
  19287.            Assistance Request form at the back of one of your manuals.
  19288.  
  19289.  U1174     mark: not allocated
  19290.  
  19291.            Note the circumstances of the failure and notify Microsoft
  19292.            Corporation by following the directions in the Microsoft Product
  19293.            Assistance Request form at the back of one of your manuals.
  19294.  
  19295.  U1175     free: not allocated
  19296.  
  19297.            Note the circumstances of the error and notify Microsoft
  19298.            Corporation by following the directions in the Microsoft Product
  19299.            Assistance Request form at the back of one of your manuals.
  19300.  
  19301.  U1180     write to extract file failed
  19302.  
  19303.            The disk or root directory was full.
  19304.  
  19305.            Delete or move files to make space.
  19306.  
  19307.  U1181     write to library file failed
  19308.  
  19309.            The disk or root directory was full.
  19310.  
  19311.            Delete or move files to make space.
  19312.  
  19313.  U1182     filename : cannot create extract file
  19314.  
  19315.            The disk or root directory was full, or the specified extract file
  19316.            already existed with read-only protection.
  19317.  
  19318.            Make space on the disk or change the protection of the extract
  19319.            file.
  19320.  
  19321.  U1183     cannot open response file
  19322.  
  19323.            The response file was not found.
  19324.  
  19325.  U1184     unexpected end-of-file on command input
  19326.  
  19327.            An end-of-file character was received prematurely in response to a
  19328.            prompt.
  19329.  
  19330.  U1185     cannot create new library
  19331.  
  19332.            The disk or root directory was full, or the library file already
  19333.            existed with read-only protection.
  19334.  
  19335.            Make space on the disk or change the protection of the library
  19336.            file.
  19337.  
  19338.  U1186     error writing to new library
  19339.  
  19340.            The disk or root directory was full.
  19341.  
  19342.            Delete or move files to make space.
  19343.  
  19344.  U1187     cannot open VM.TMP
  19345.  
  19346.            The disk or root directory was full.
  19347.  
  19348.            Delete or move files to make space.
  19349.  
  19350.  U1188     cannot write to VM
  19351.  
  19352.            The library manager cannot write to the virtual memory. Note the
  19353.            circumstances of the failure and notify Microsoft Corporation by
  19354.            following the directions in the Microsoft Product Assistance
  19355.            Request form at  the back of one of your manuals.
  19356.  
  19357.  U1189     cannot read from VM
  19358.  
  19359.            The library manager cannot read the virtual memory. Note the
  19360.            circumstances of the error and notify Microsoft Corporation by
  19361.            following the directions in the Microsoft Product Assistance
  19362.            Request form at the back of one of your manuals.
  19363.  
  19364.  U1190     interrupted by user
  19365.  
  19366.            You interrupted LIB during its operation, with CTRL+C or
  19367.            CTRL+BREAK.
  19368.  
  19369.  U1200     name : invalid library header
  19370.  
  19371.            The input library file had an invalid format. It was either not a
  19372.            library file or it had been corrupted.
  19373.  
  19374.  U1203     name : invalid object module near location
  19375.  
  19376.            The module specified by name was not a valid object module.
  19377.  
  19378.  
  19379.  C.4.2  Nonfatal LIB Error Messages
  19380.  
  19381.  U2152     filename : cannot create listing
  19382.  
  19383.            The directory or disk was full, or the cross-reference-listing
  19384.            file already existed with read-only protection.
  19385.  
  19386.            Make space on the disk or change the protection of the
  19387.            cross-reference-listing file.
  19388.  
  19389.  U2155     modulename : module not in library; ignored
  19390.  
  19391.            The specified module was not found in the input library.
  19392.  
  19393.  U2157     filename : cannot access file
  19394.  
  19395.            LIB was unable to open the specified file.
  19396.  
  19397.  U2158     libraryname : invalid library header; file ignored
  19398.  
  19399.            The input library had an incorrect format.
  19400.  
  19401.  U2159     filename : invalid format hexnumber; file ignored
  19402.  
  19403.            The signature byte or word hexnumber of the given file was not one
  19404.            of the following recognized types: Microsoft library, Intel
  19405.            library, Microsoft object, or Xenix archive.
  19406.  
  19407.  
  19408.  C.5.3  Warning LIB Error Messages
  19409.  
  19410.  U4150     modulename : module redefinition ignored
  19411.  
  19412.            A module was specified to be added to a library but a module with
  19413.            the same name was already in the library, or a module with the
  19414.            same name was found more than once in the library.
  19415.  
  19416.  U4151     name : symbol defined in modulename, redefinition ignored
  19417.  
  19418.            The specified symbol was defined in more than one module.
  19419.  
  19420.  U4153     number : page size too small; ignored
  19421.  
  19422.            The value specified in the /PAGESIZE option was less than 16.
  19423.  
  19424.  U4155     modulename : module not in library
  19425.  
  19426.            A module specified to be replaced does not already exist in the
  19427.            library. LIB adds the module anyway.
  19428.  
  19429.  U4156     libraryname : output-library specification ignored
  19430.  
  19431.            An output library was specified in addition to a new library name.
  19432.            For example, specifying
  19433.  
  19434.            LIB new.lib+one.obj,new.lst,new.lib
  19435.  
  19436.            where new.lib does not already exist, causes this error.
  19437.  
  19438.  U4157     insufficient memory, extended dictionary not created
  19439.  
  19440.            Insufficient memory prevented LIB from creating an extended
  19441.            dictionary. The library is still valid, but the linker will not be
  19442.            able to take advantage of the extended dictionary to speed
  19443.            linking.
  19444.  
  19445.  U4158     internal error, extended dictionary not created
  19446.  
  19447.            An internal error prevented LIB from creating an extended
  19448.            dictionary. The library is still valid, but the linker will not be
  19449.            able to take advantage of the extended dictionary to speed
  19450.            linking.
  19451.  
  19452.  
  19453.  C.5  NMAKE Error Messages
  19454.  
  19455.  Error messages from the NMAKE utility have one of the following formats:
  19456.  
  19457.       {filename | NMAKE} : fatal error U1xxx: messagetext
  19458.       {filename | NMAKE} : warning U4xxx: messagetext
  19459.  
  19460.  The message begins with the input-file name (filename) and line number, if
  19461.  one exists, or with the name of the utility.
  19462.  
  19463.  NMAKE generates the following error messages.
  19464.  
  19465.  
  19466.  C.5.1  Fatal NMAKE Error Messages
  19467.  
  19468.  U1000     syntax error: ')' missing in macro invocation
  19469.  
  19470.            A left parenthesis (() appeared without a matching right
  19471.            parenthesis ()) in a macro invocation. The correct form is
  19472.            $(name), or $n for one-character names.
  19473.  
  19474.  U1001     syntax error : illegal character 'character' in macro
  19475.  
  19476.            A nonalphanumeric character other than an underscore (_) appeared
  19477.            in a macro.
  19478.  
  19479.  U1002     syntax error : bad macro invocation '$'
  19480.  
  19481.            A single dollar sign ($) appeared without a macro name associated
  19482.            with it. The correct form is $(name). To use a dollar sign in the
  19483.            file, type it twice or precede it with a caret (^).
  19484.  
  19485.  U1003     syntax error : '=' missing in macro
  19486.  
  19487.            The equal sign (=) was missing in a macro definition. The correct
  19488.            form is 'name = value'.
  19489.  
  19490.  U1004     syntax error : macro name missing
  19491.  
  19492.            A macro invocation appeared without a name. The correct form is
  19493.            $(name).
  19494.  
  19495.  U1005     syntax error : text must follow ':' in macro
  19496.  
  19497.            A string substitution was specified for a macro, but the string to
  19498.            be changed in the macro was not specified.
  19499.  
  19500.  U1016     syntax error : closing '"' missing
  19501.  
  19502.            An opening double quotation mark (") appeared without a closing
  19503.            double quotation mark.
  19504.  
  19505.  U1017     unknown directive 'directive'
  19506.  
  19507.            The directive specified is not one of the recognized directives.
  19508.  
  19509.  U1018     directive and/or expression part missing
  19510.  
  19511.            The directive is incompletely specified. The expression part is
  19512.            required.
  19513.  
  19514.  U1019     too many nested if blocks
  19515.  
  19516.            Note the circumstances of the failure and notify Microsoft
  19517.            Corporation by following the directions in the Microsoft Product
  19518.            Assistance Request form at the back of one of your manuals.
  19519.  
  19520.  U1020     EOF found before next directive
  19521.  
  19522.            A directive, such as !ENDIF, was missing.
  19523.  
  19524.  U1021     syntax error : else unexpected
  19525.  
  19526.            An !ELSE directive was found that was not preceded by !IF, !IFDEF,
  19527.            or !IFNDEF, or was placed in a syntactically incorrect place.
  19528.  
  19529.  U1022     Missing terminating char for string/program invocation :
  19530.            'character'
  19531.  
  19532.            The closing double quotation mark (") in a string comparison in a
  19533.            directive was missing, or the closing bracket (]) in a program
  19534.            invocation in a directive was missing.
  19535.  
  19536.  U1023     syntax error present in expression
  19537.  
  19538.            An expression is invalid. Check the allowed operators and operator
  19539.            precedence.
  19540.  
  19541.  U1024     illegal argument to !CMDSWITCHES
  19542.  
  19543.            An unrecognized command switch was specified.
  19544.  
  19545.  U1031     file name missing
  19546.  
  19547.            An include directive was found, but the name of the file to
  19548.            include was missing.
  19549.  
  19550.  U1033     syntax error : 'string' unexpected
  19551.  
  19552.            The specified string is not part of the valid syntax for a
  19553.            makefile.
  19554.  
  19555.  U1034     syntax error : separator missing
  19556.  
  19557.            The colon (:) that separates target(s) and dependent(s) is
  19558.            missing.
  19559.  
  19560.  U1035     syntax error : expected separator or '='
  19561.  
  19562.            Either a colon (:), implying a dependency line, or an equal sign
  19563.            (=), implying a macro definition, was expected.
  19564.  
  19565.  U1036     syntax error : too many names to left of '='
  19566.  
  19567.            Only one string is allowed to the left of a macro definition.
  19568.  
  19569.  U1037     syntax error : target name missing
  19570.  
  19571.            A colon (:) was found before a target name was found. At least one
  19572.            target is required.
  19573.  
  19574.  U1038     internal error : lexer
  19575.  
  19576.            Note the circumstances of the failure and notify Microsoft
  19577.            Corporation by following the directions in the Microsoft Product
  19578.            Assistance Request form at the back of one of your manuals.
  19579.  
  19580.  U1039     internal error : parser
  19581.  
  19582.            Note the circumstances of the failure and notify Microsoft
  19583.            Corporation by following the directions in the Microsoft Product
  19584.            Assistance Request form at the back of one of your manuals.
  19585.  
  19586.  U1040     internal error : macro-expansion
  19587.  
  19588.            Note the circumstances of the failure and notify Microsoft
  19589.            Corporation by following the directions in the Microsoft Product
  19590.            Assistance Request form at the back of one of your manuals.
  19591.  
  19592.  U1041     internal error : target building
  19593.  
  19594.            Note the circumstances of the failure and notify Microsoft
  19595.            Corporation by following the directions in the Microsoft Product
  19596.            Assistance Request form at the back of one of your manuals.
  19597.  
  19598.  U1042     internal error : expression stack overflow
  19599.  
  19600.            Note the circumstances of the failure and notify Microsoft
  19601.            Corporation by following the directions in the Microsoft Product
  19602.            Assistance Request form at the back of one of your manuals.
  19603.  
  19604.  U1043     internal error : temp file limit exceeded
  19605.  
  19606.            Note the circumstances of the failure and notify Microsoft
  19607.            Corporation by following  the directions in the Microsoft Product
  19608.            Assistance Request form at the back of one of your manuals.
  19609.  
  19610.  U1044     internal error : too many levels of recursion building a target
  19611.  
  19612.            Note the circumstances of the failure and notify Microsoft
  19613.            Corporation by following the directions in the Microsoft Product
  19614.            Assistance Request form at the back of one of your manuals.
  19615.  
  19616.  U1050     user-specified text
  19617.  
  19618.            The message specified with the !ERROR directive is displayed.
  19619.  
  19620.  U1051     'progname' usage : [-acdeinpqrst -f makefile -x stderrfile]
  19621.            [macrodefs] [targets]
  19622.  
  19623.            An error was made trying to invoke NMAKE.
  19624.  
  19625.            Use the specified form.
  19626.  
  19627.  U1052     out of memory
  19628.  
  19629.            The program ran out of space in the far heap. Split the
  19630.            description into smaller and simpler pieces.
  19631.  
  19632.  U1053     file 'filename' not found
  19633.  
  19634.            The file was not found. The file name might not be properly
  19635.            specified in the makefile.
  19636.  
  19637.  U1054     file 'filename' unreadable
  19638.  
  19639.            The file cannot be read. The file might not have the appropriate
  19640.            attributes for reading.
  19641.  
  19642.  U1055     can't create response file 'filename'
  19643.  
  19644.            The response file cannot be created.
  19645.  
  19646.  U1056     out of environment space
  19647.  
  19648.            The environment space limit was reached.
  19649.  
  19650.            Restart the program with a larger environment space.
  19651.  
  19652.  U1057     can't find command.com
  19653.  
  19654.            The COMMAND.COM file could not be found.
  19655.  
  19656.  U1058     unlink of file 'filename' failed
  19657.  
  19658.            Unlink of the temporary response file failed.
  19659.  
  19660.  U1059     terminated by user
  19661.  
  19662.            Execution of NMAKE aborted because you typed CTRL+C or CTRL+BREAK.
  19663.  
  19664.  U1070     cycle in macro definition 'macroname'
  19665.  
  19666.            A circular definition was detected in the macro definition
  19667.            specified. This is an invalid definition.
  19668.  
  19669.  U1071     cycle in dependency tree for target 'targetname'
  19670.  
  19671.            A circular dependency was detected in the dependency tree for the
  19672.            specified target. This is invalid.
  19673.  
  19674.  U1072     cycle in include files filenames
  19675.  
  19676.            A circular inclusion was detected in the include files specified.
  19677.            That is, each file includes the other.
  19678.  
  19679.  U1073     don't know how to make 'targetname'
  19680.  
  19681.            The specified target does not exist and there are no commands to
  19682.            execute or inference rules given for it. Hence it cannot be built.
  19683.  
  19684.  U1074     macro definition too long
  19685.  
  19686.            The macro definition is too long.
  19687.  
  19688.  U1075     string too long
  19689.  
  19690.            The text string would overflow an internal buffer.
  19691.  
  19692.  U1076     name too long
  19693.  
  19694.            The macro name, target name, or build-command name would overflow
  19695.            an internal buffer. Macro names may be at most 128 characters.
  19696.  
  19697.  U1077     'program' : return code value
  19698.  
  19699.            The given program invoked from NMAKE failed, returning the error
  19700.            code value.
  19701.  
  19702.  U1078     constant overflow at 'directive'
  19703.  
  19704.            A constant in directive's expression was too big.
  19705.  
  19706.  U1079     illegal expression: divide by zero present
  19707.  
  19708.            An expression tries to divide by zero.
  19709.  
  19710.  U1080     operator and/or operand out of place: usage illegal
  19711.  
  19712.            The expression incorrectly uses an operator or operand.
  19713.  
  19714.            Check the allowed set of operators and their precedence.
  19715.  
  19716.  U1081     'program' : program not found
  19717.  
  19718.            NMAKE could not find the given program in order to run it.
  19719.  
  19720.            Make sure that the program is in the current path and has the
  19721.            correct extension.
  19722.  
  19723.  U1082     command cannot execute command: out of memory
  19724.  
  19725.  
  19726.            NMAKE cannot execute the given command because there is not enough
  19727.            memory. Free memory and run NMAKE again.
  19728.  
  19729.  U1085     can't mix implicit and explicit rules
  19730.  
  19731.            A regular target was specified along with the target for a rule
  19732.            (which has the form .fromext.toext). This is invalid.
  19733.  
  19734.  U1086     inference rule can't have dependents
  19735.  
  19736.            Dependents are not allowed when an inference rule is being
  19737.            defined.
  19738.  
  19739.  U1087     can't have : and :: dependents for same target
  19740.  
  19741.            A target cannot have both a single-colon (:) and a double-colon
  19742.            (::) dependency.
  19743.  
  19744.  U1088     invalid separator on inference rules: '::'
  19745.  
  19746.            Inference rules can use only a single-colon (:) separator.
  19747.  
  19748.  U1089     can't have build commands for pseudotarget 'targetname'
  19749.  
  19750.            Pseudotargets (for example, .PRECIOUS, .SUFFIXES) cannot have
  19751.            build commands specified.
  19752.  
  19753.  U1090     can't have dependents for pseudotarget 'targetname'
  19754.  
  19755.            The specified pseudotarget (for example, .SILENT, .IGNORE) cannot
  19756.            have a dependent.
  19757.  
  19758.  U1091     invalid suffixes in inference rule
  19759.  
  19760.            The suffixes being used in the inference rule are invalid.
  19761.  
  19762.  U1092     too many names in rule
  19763.  
  19764.            An inference rule cannot have more than one pair of extensions
  19765.            (.fromext.toext) as a target.
  19766.  
  19767.  U1093     can't mix special pseudotargets
  19768.  
  19769.            It is illegal to list two or more pseudotargets together.
  19770.  
  19771.  
  19772.  C.5.2  Warning NMAKE Error Messages
  19773.  
  19774.  U4011     command file can only be invoked from command line
  19775.  
  19776.            A command file cannot be invoked from within another command file.
  19777.            Such an invocation is ignored.
  19778.  
  19779.  U4012     resetting value of special macro 'macroname'
  19780.  
  19781.            The value of a macro such as $(MAKE) was changed within a
  19782.            description file.
  19783.  
  19784.            The name by which this program was invoked is not a tagged section
  19785.            in the TOOLS.INI file.
  19786.  
  19787.  U4015     no match found for wildcard 'filename'
  19788.  
  19789.            There are no file names that match the specified target or
  19790.            dependent file with the wild-card characters asterisk (*) and
  19791.            question mark (?).
  19792.  
  19793.  U4016     too many rules for target 'targetname'
  19794.  
  19795.            Multiple blocks of build commands are specified for a target using
  19796.            single colons (:) as separators.
  19797.  
  19798.  U4017     ignoring rule rule (extension not in .SUFFIXES)
  19799.  
  19800.            The rule was ignored because the suffix(es) in the rule are not
  19801.            listed in the .SUFFIXES list.
  19802.  
  19803.  U4018     special macro undefined 'macroname'
  19804.  
  19805.            The special macro macroname is undefined.
  19806.  
  19807.  U4019     Filename 'filename' too long; truncating to 8.3
  19808.  
  19809.            The base name of the file has more than eight characters or the
  19810.            extension has more than three characters. NMAKE truncates the name
  19811.            to an eight-character base and a three-character extension.
  19812.  
  19813.  U4020     removed target 'target'
  19814.  
  19815.            Execution of NMAKE was interrupted while it was trying to build
  19816.            the given target, and therefore the target was incomplete. Because
  19817.            the target was not specified in the .PRECIOUS list, NMAKE has
  19818.            deleted it.
  19819.  
  19820.  
  19821.  C.6  EXEMOD Error Messages
  19822.  
  19823.  Error messages from the Microsoft EXE File Header Utility, EXEMOD, have one
  19824.  of the following formats:
  19825.  
  19826.       {filename| EXEMOD} : fatal error U1xxx:messagetext
  19827.       {filename| EXEMOD} : warning U4xxx: messagetext
  19828.  
  19829.  The message begins with the input-file name (filename), if one exists, or
  19830.  with the name of the utility. If possible, EXEMOD prints a warning and
  19831.  continues operation. In some cases errors are fatal and EXEMOD terminates
  19832.  processing.
  19833.  
  19834.  EXEMOD generates the following error messages:
  19835.  
  19836.  
  19837.  C.6.1  Fatal EXEMOD Error Messages
  19838.  
  19839.  U1050     usage : exemod file [-/h] [-/stack n] [-/max n] [-/min n]
  19840.  
  19841.            The EXEMOD command line was not specified properly.
  19842.  
  19843.            Try again using the syntax shown. Note that the option indicator
  19844.            can be either a slash (/) or a hyphen (-). The single brackets
  19845.            ([ ]) in the error message indicate that your choice of the item
  19846.            within them is optional.
  19847.  
  19848.  U1051     invalid .EXE file : bad header
  19849.  
  19850.            The specified input file is not an executable file or it has an
  19851.            invalid file header.
  19852.  
  19853.  U1052     invalid .EXE file : actual length less than reported
  19854.  
  19855.            The second and third fields in the input-file header indicate a
  19856.            file size greater than the actual size.
  19857.  
  19858.  U1053     cannot change load-high program
  19859.  
  19860.            When the minimum allocation value and the maximum allocation value
  19861.            are both 0, the file cannot be modified.
  19862.  
  19863.  U1054     file not .EXE
  19864.  
  19865.            EXEMOD automatically appends the .EXE extension to any file name
  19866.            without an extension; in this case, no file with the given name
  19867.            and an .EXE extension could be found.
  19868.  
  19869.  U1055     filename : cannot find file
  19870.  
  19871.            The file specified by filename could not be found.
  19872.  
  19873.  U1056     filename : permission denied
  19874.  
  19875.            The file specified by filename was a read only file.
  19876.  
  19877.  
  19878.  C.6.2  Warning EXEMOD Error Messages
  19879.  
  19880.  U4050     packed file
  19881.  
  19882.            The given file was a packed file. This is a warning only.
  19883.  
  19884.  U4051     minimum allocation less than stack; correcting minimum
  19885.  
  19886.            If the minimum allocation value is not enough to accommodate the
  19887.            stack (either the original stack request or the modified request),
  19888.            the minimum allocation value is adjusted. This is a warning
  19889.            message only; the modification is still performed.
  19890.  
  19891.  U4052     minimum allocation greater than maximum; correcting maximum
  19892.  
  19893.            If the minimum allocation value is greater than the maximum
  19894.            allocation value, the maximum allocation value is adjusted. This
  19895.            is a warning message only; EXEMOD will still modify the file. The
  19896.            values shown if you ask for a display of DOS header values will be
  19897.            the values after the packed file is expanded.
  19898.  
  19899.  
  19900.  C.7  SETENV Error Messages
  19901.  
  19902.  Messages generated by the Microsoft Environment Expansion Utility, SETENV,
  19903.  have the following format:
  19904.  
  19905.       {filename | SETENV} :fatal error U1xxx:messagetext
  19906.  
  19907.  The message begins with the input-file name (filename), if one exists, or
  19908.  with the name of the utility.
  19909.  
  19910.  SETENV generates the following fatal error messages:
  19911.  
  19912.  U1080     usage : setenv <command.com> [envsize]
  19913.  
  19914.            The command line was not specified properly. This usually
  19915.            indicates that the wrong number of arguments was given.
  19916.  
  19917.            Try again with the syntax shown in the message.
  19918.  
  19919.  U1081     unrecognizable COMMAND.COM
  19920.  
  19921.            The COMMAND.COM file was not one of the accepted versions (DOS
  19922.            Versions 2.0, 2.1, 2.11, 3.0, and 3.1).
  19923.  
  19924.  U1082     maximum for Version 3.1 : 992
  19925.  
  19926.            You specified a file recognized as COMMAND.COM for IBM PC-DOS,
  19927.            Version 3.1, and gave an environment size greater than 992 bytes,
  19928.            the maximum allowed for that version.
  19929.  
  19930.  U1083     maximum environment size : 65520
  19931.  
  19932.            The environment size specified was greater than 65,520 bytes, the
  19933.            maximum size allowed.
  19934.  
  19935.  U1084     minimum environment size : 160
  19936.  
  19937.            The environment size specified was less than 160 bytes, the
  19938.            minimum size allowed.
  19939.  
  19940.  U1085     filename : cannot find file
  19941.  
  19942.            The specified file was not found, perhaps because it was a
  19943.            directory or some other special file.
  19944.  
  19945.  U1086     filename : permission denied
  19946.  
  19947.            The specified file was a read only file.
  19948.  
  19949.  U1087     filename : unknown error
  19950.  
  19951.            An unknown system error occurred while the specified file was
  19952.            being read or written.
  19953.  
  19954.  
  19955.  Glossary
  19956.  ───────────────────────────────────────────────────────────────────────────
  19957.  
  19958.  8087 or 80287 coprocessor
  19959.    Intel hardware products that perform much faster math calculations than
  19960.    the main processor.
  19961.  
  19962.  adapter
  19963.    A term sometimes used to refer to printed-circuit cards that plug into a
  19964.    computer and control a device, such as a video display or a printer.
  19965.  
  19966.  address
  19967.    An expression that evaluates to a location in memory. Addresses can be
  19968.    given in the segment offset format. If the segment is not given, the
  19969.    default segment is assumed. The default segment is CS for commands related
  19970.    to code and DS for commands related to data.
  19971.  
  19972.  address range
  19973.    A range of memory bounded by two addresses. The range can be specified in
  19974.    the normal format by giving the starting and ending addresses (inclusive),
  19975.    or it can be specified in the object-range format by specifying the
  19976.    starting address followed first by the letter (uppercase or lowercase) and
  19977.    then by the number of objects in the range (0x100 L 10, for example,
  19978.    specifies the range from 0x100 to 0x109, inclusive).
  19979.  
  19980.  Applications Program Interface (API)
  19981.    The set of calls a program uses to obtain services from the operating
  19982.    system. The term API denotes a service interface, whatever its form.
  19983.    Generally used to refer to OS/2 system calls.
  19984.  
  19985.  argc
  19986.    The conventional name for the first argument to the main function in a C
  19987.    source program (an integer specifying how many arguments are passed to the
  19988.    program from the command line).
  19989.  
  19990.  argument
  19991.    A value passed to a function.
  19992.  
  19993.  argv
  19994.    The conventional name for the second argument to the main function in a C
  19995.    source program (a pointer to an array of strings). The first string is the
  19996.    program name and each following string is an argument passed to the
  19997.    program from the command line.
  19998.  
  19999.  array
  20000.    A set of elements with the same type.
  20001.  
  20002.  ASCII (American Standard Code for Information Interchange)
  20003.    A set of 256 codes that many computers use to represent letters, digits,
  20004.    special characters, and other symbols.  Only the first 128 of these codes
  20005.    are standardized; the remaining 128 are special characters defined by the
  20006.    computer manufacturer.
  20007.  
  20008.  assembly mode
  20009.    The mode in which the CodeView debugger displays assembly-language-
  20010.    instruction mnemonics to represent the code being executed.
  20011.  
  20012.  base name
  20013.    The part of a file name before the extension. For example, SAMPLE is the
  20014.    base name of the file SAMPLE.BAS.
  20015.  
  20016.  BASIC
  20017.    A programming language included with versions of DOS. BASIC is an acronym
  20018.    for Beginner's All-purpose Symbolic Instruction Code.
  20019.  
  20020.  Basic Input/Output System (BIOS)
  20021.    The code built into system memory that provides hardware interface
  20022.    routines for programs. You can trace into the BIOS with the CodeView
  20023.    debugger, using assembly mode.
  20024.  
  20025.  batch file
  20026.    A text file containing MS-DOS commands that can be invoked from the MS-DOS
  20027.    command line.
  20028.  
  20029.  breakpoint
  20030.    A specified address where program execution will be halted. The CodeView
  20031.    debugger interrupts execution whenever the program reaches an address
  20032.    where a breakpoint has been set. See also "watchpoint" and "tracepoint"
  20033.    for a description of conditional breakpoints.
  20034.  
  20035.  buffer
  20036.    An area in memory in which a copy of the file is kept and changed as you
  20037.    edit. This buffer is copied to disk when you do a save operation.
  20038.  
  20039.  call gate
  20040.    A special LDT or GDT entry that describes a subroutine entry point rather
  20041.    than a memory segment. A far call to a call gate selector will cause a
  20042.    transfer to the entry point specified in the call gate. This is a feature
  20043.    of the 80286/80386 hardware and is normally used to provide a transition
  20044.    from a lower privilege state to a higher one.
  20045.  
  20046.  CGA
  20047.    IBM's Color Graphics Adapter.
  20048.  
  20049.  character string
  20050.    A sequence of bytes treated as a set of ASCII letters or numbers.
  20051.  
  20052.  Child process
  20053.    A process created by another process (its parent process).
  20054.  
  20055.  click
  20056.    To press and release one of the mouse buttons while pointing the mouse at
  20057.    an object on the screen.
  20058.  
  20059.  Color Graphics Adapter (CGA)
  20060.    A video adapter capable of displaying text characters or graphics pixels.
  20061.    Color can also be displayed with the appropriate display monitor.
  20062.  
  20063.  command
  20064.    An instruction you use to control a computer program, such as DOS or an
  20065.    application program.
  20066.  
  20067.  command file
  20068.    A file that contains the program or instructions required to carry out a
  20069.    command. If the file's extension is COM or EXE, the command file contains
  20070.    machine instructions; if its extension is BAT, the command file is a batch
  20071.    file and contains DOS commands; if its extension is CMD, the command file
  20072.    contains OS/2 commands.
  20073.  
  20074.  compile
  20075.    The action performed to translate programming language statements to a
  20076.    form that can be executed by the computer.
  20077.  
  20078.  constant
  20079.    A value that does not change during program execution. A variable, on the
  20080.    other hand, is a value that can──and usually does──change during program
  20081.    execution.
  20082.  
  20083.  constant expression
  20084.    Any expression that evaluates to a constant and may involve integer
  20085.    constants, character constants, floating-point constants, enumeration
  20086.    constants, type casts to integral and floating-point types, and other
  20087.    constant expressions.
  20088.  
  20089.  CPU
  20090.    Central Processing Unit, or the main processor in a computer. For example,
  20091.    the CPU is an Intel 8088 in PCs and an 80286 in PC/ATs.
  20092.  
  20093.  Ctrl-C
  20094.    Same as CTRL-BREAK.
  20095.  
  20096.  Ctrl-S
  20097.    Same as CTRL-NUM LOCK.
  20098.  
  20099.  cursor
  20100.    The thin blinking line that represents the current location where the next
  20101.    character you type appears. The cursor automatically moves to the dialog
  20102.    window when you start entering a command.
  20103.  
  20104.  debugger
  20105.    A program that helps the programmer locate the source of problems found
  20106.    during runtime testing of a program.
  20107.  
  20108.  dialog box
  20109.    A box that appears when you choose a menu command that requires additional
  20110.    information.
  20111.  
  20112.  dialog commands
  20113.    Commands entered in the dialog window in window mode, or any command in
  20114.    sequential mode. Dialog commands consist of one- or two-character commands
  20115.    that can usually be followed by arguments.
  20116.  
  20117.  dialog window
  20118.    The window at the bottom of the CodeView screen where dialog commands can
  20119.    be entered and previously entered dialog commands can be reviewed.
  20120.  
  20121.  double precision
  20122.    A real (floating-point) value that occupies eight bytes of memory.
  20123.    Double-precision values are accurate to 15 or 16 digits.
  20124.  
  20125.  drag
  20126.    To point the mouse at an object on the screen, press a mouse button, and
  20127.    then move the mouse while holding the button down.
  20128.  
  20129.  dump
  20130.    Contents of memory displayed at a specified memory location. In the
  20131.    CodeView debugger, the size of the object to be displayed is specified
  20132.    with a type character from the following list: A (ASCII), B (Byte), I
  20133.    (Integer), U (Unsigned Integer), W (Word), D (Double Word), SP (Short
  20134.    Real), L (Long Real), or T (10-Byte Real).
  20135.  
  20136.  dynamic link
  20137.    A method of postponing the resolution of external references until
  20138.    loadtime or runtime. A dynamic link allows the called subroutines to be
  20139.    packaged, distributed, and maintained independently of their callers. OS/2
  20140.    extends the dynamic link mechanism to serve as the primary method by which
  20141.    all system and nonsystem services are obtained.
  20142.  
  20143.  dynamic-link library
  20144.    A file, in a special format, that contains the binary code for a group of
  20145.    dynamically linked subroutines.
  20146.  
  20147.  dynamic-link routine
  20148.    See "dynamic link."
  20149.  
  20150.  Enhanced graphics adapter (EGA)
  20151.    A video adapter capable of displaying in all the modes of the color
  20152.    graphics adapter (CGA) plus additional modes. The CodeView 43 option
  20153.    displays in the EGA's 43-line text mode.
  20154.  
  20155.  environment strings
  20156.    A series of user-definable and program-definable strings associated with
  20157.    each process. The initial values of environment strings are established by
  20158.    a process's parent.
  20159.  
  20160.  environment table
  20161.    The part of MS-DOS that stores environment variables and their values.
  20162.  
  20163.  environment variable
  20164.    A variable stored in the environment table that provides MS-DOS with
  20165.    information (where to find executable files and library files, where to
  20166.    create  temporary files, etc.).
  20167.  
  20168.  Esc
  20169.    Escape key.
  20170.  
  20171.  escape sequence
  20172.    A specific combination of a backslash (\) followed by a letter or
  20173.    combination of digits. The combination represents white-space and
  20174.    nongraphic characters within strings and character constants.
  20175.  
  20176.  executable file
  20177.    A file with an extension of .EXE, .COM, .BAT, or .CMD. Executable files
  20178.    can be run by typing the file name at the system prompt.
  20179.  
  20180.  executable program
  20181.    A file that contains executable program code. When the name of the file is
  20182.    typed at the system prompt, the statements in the file are executed.
  20183.  
  20184.  exit code
  20185.    A code returned by a program to MS-DOS indicating whether the program ran
  20186.    successfully.
  20187.  
  20188.  expression
  20189.    A combination of operands and operators that yields a single value.
  20190.  
  20191.  Family Applications Program Interface (Family API)
  20192.    A standard execution environment under MS-DOS versions 2.x and 3.x and
  20193.    OS/2. The programmer can use the Family API to create an application that
  20194.    uses a subset of OS/2 functions (but a superset of MS-DOS 3.x functions)
  20195.    and that runs in a binary-compatible fashion under MS-DOS versions 2.x and
  20196.    3.x and OS/2.
  20197.  
  20198.  far address
  20199.    A memory location specified by using a segment (location of a 64K block)
  20200.    and an offset from the beginning of the segment. Far addresses require
  20201.    four bytes──two for the segment and two for the offset. A far address is
  20202.    also known as a segmented address. See  "near address."
  20203.  
  20204.  file
  20205.    A named collection of information stored on a disk. The file usually
  20206.    contains either data or a program.
  20207.  
  20208.  flags
  20209.    A register that contains individual bits, each of which signals a
  20210.    condition that can be tested by a machine-level instruction. In other
  20211.    registers, the contents of the register are considered as a whole, while
  20212.    in the flags register only the individual bits have meaning. In the
  20213.    CodeView debugger, the current values of the most commonly used bits of
  20214.    the flags register are shown at the bottom of the register window. See
  20215.    "registers."
  20216.  
  20217.  flipping
  20218.    A screen-exchange method that uses the video pages of the CGA or EGA to
  20219.    store both the debugging and output screens. Video pages are areas of
  20220.    memory reserved for screen storage. When you request the other screen, the
  20221.    two video pages are exchanged. This method is faster than swapping──the
  20222.    other screen-exchange method──but it does not work with the MA or with
  20223.    programs that do graphics or use the video pages. See also "screen
  20224.    exchange" and "swapping."
  20225.  
  20226.  function
  20227.    A subroutine or procedure that returns a value.
  20228.  
  20229.  function call
  20230.    A call to a a subroutine that performs a specific action. In C (source
  20231.    mode), subroutines are called functions. In assembly language (assembly
  20232.    mode), subroutines are called procedures.
  20233.  
  20234.  global symbol
  20235.    A symbol that is available throughout the entire program. In the CodeView
  20236.    debugger, function names are always global symbols. See also "local
  20237.    symbol."
  20238.  
  20239.  global variable
  20240.    A variable that is available throughout a module.
  20241.  
  20242.  grandparent process
  20243.    The parent process of a process that created a process.
  20244.  
  20245.  hexadecimal
  20246.    The base-16 numbering system whose digits are 0 through F (the letters A
  20247.    through F represent the decimal numbers 10 through 15). Hexadecimal is
  20248.    often used in computer programming because it is easily converted to and
  20249.    from binary, the base-2 numbering system the computer itself uses.
  20250.  
  20251.  highlight
  20252.    A reverse-video area in a text box, window, or menu marking the current
  20253.    command chosen or text that has been selected for copying or deleting.
  20254.  
  20255.  I/O privilege mechanism
  20256.    A facility that allows a process to ask a device driver for direct access
  20257.    to the device's I/O ports and any dedicated or mapped memory locations it
  20258.    has. The I/O privilege mechanism can be used directly by an application or
  20259.    indirectly by a dynamic-link package.
  20260.  
  20261.  identifier
  20262.    A name that identifies a register or a location in memory. The terms
  20263.    identifier and symbol are used synonymously in CodeView documentation.
  20264.  
  20265.  IEEE format (Institute for Electrical and Electronic Engineers, Inc.)
  20266.    A method of representing floating-point numbers internally.
  20267.  
  20268.  include file
  20269.    A source file that is merged into a program with the $INCLUDE metacommand
  20270.    or the C #include directive.
  20271.  
  20272.  integer
  20273.    A whole number represented inside the machine as a 16-bit two's complement
  20274.    binary number. An integer has a range of -32,768 to +32,767. See "long
  20275.    integer."
  20276.  
  20277.  interrupt call
  20278.    A machine-level procedure that can be called to execute a BIOS, MS-DOS, or
  20279.    other function. You can trace into BIOS interrupts with the CodeView
  20280.    debugger, but not into the MS-DOS interrupt (0x21).
  20281.  
  20282.  label
  20283.    A symbol (identifier) representing an address in the code segment (CS)
  20284.    register. Labels in C programs can be either function names or labels for
  20285.    goto statements.
  20286.  
  20287.  link
  20288.    The step that the linker performs to produce an executable file. The link
  20289.    step resolves references to procedures or variables in other modules and
  20290.    creates a complete program ready for execution.
  20291.  
  20292.  linking
  20293.    The process in which the linker loads modules into memory, computes
  20294.    absolute offset addresses for routines  and variables in relocatable
  20295.    modules, and resolves all external references by searching the run-time
  20296.    library. After loading and linking, the linker saves the modules it has
  20297.    loaded into memory as a single executable file.
  20298.  
  20299.  local symbol
  20300.    A symbol that only has value within a particular function. A function
  20301.    argument or a variable declared as auto or static within a function can be
  20302.    a local symbol. See "global symbol."
  20303.  
  20304.  local variable
  20305.    A variable whose scope is confined to a particular unit of code, such as
  20306.    the module-level code, or a procedure within a module.
  20307.  
  20308.  long integer
  20309.    A whole number represented inside the machine by a 32-bit two's complement
  20310.    value. Long integers have a range of -2,147,483,648 to +2,147,483,647. See
  20311.    "integer."
  20312.  
  20313.  lvalue
  20314.    An expression (such as a variable name) that refers to a single memory
  20315.    location and is required as the left-hand operand of an assignment
  20316.    operation or the single operand of a unary operator. For example, X1 is an
  20317.    lvalue, but X1+X2 is not.
  20318.  
  20319.  machine code
  20320.    A series of binary numbers that a microprocessor executes as program
  20321.    instructions.
  20322.  
  20323.  macro
  20324.    A method for representing a long series of characters or statements with a
  20325.    symbol.  The macro is expanded by the C or MASM preprocessor.  C and MASM
  20326.    each have their own conventions for defining macros.
  20327.  
  20328.  math coprocessor
  20329.    An optional hardware component, such as an 8087 or  80287 chip, that
  20330.    improves the speed of arithmetic involving floating-point numbers.
  20331.  
  20332.  menu bar
  20333.    The bar at the top of the CodeView display containing menu titles and the
  20334.    titles Trace and Go.
  20335.  
  20336.  Microsoft binary format
  20337.    A method of representing floating-point numbers internally.
  20338.  
  20339.  module
  20340.    A discrete group of statements. Every program has at least one module (the
  20341.    main module). In most cases, each module corresponds to one source file.
  20342.    When you save a program containing multiple modules, each module is saved
  20343.    in a separate disk file.
  20344.  
  20345.  Monochrome Adapter (MA)
  20346.    A video adapter capable of displaying only in black and white. Most
  20347.    monochrome adapters display text only; individual graphics pixels cannot
  20348.    be displayed. The CodeView debugger recognizes monochrome adapters and
  20349.    automatically selects swapping as the screen-exchange mode.
  20350.  
  20351.  mouse
  20352.    A pointing device that fits under your hand and rolls in any direction on
  20353.    a flat surface. By moving the mouse, you can move the mouse pointer in a
  20354.    corresponding direction on the screen. See "pointer."
  20355.  
  20356.  mouse pointer
  20357.    The reverse-video square that moves to indicate the current position of
  20358.    the mouse. The mouse pointer only appears if a mouse is installed. To
  20359.    select an item with the mouse, move the mouse until the pointer rests on
  20360.    the item.
  20361.  
  20362.  multitasking operating system
  20363.    An operating system in which two or more programs/threads can execute
  20364.    simultaneously.
  20365.  
  20366.  NAN
  20367.    An acronym that stands for "not a number." The 8087 or 80287 coprocessor
  20368.    generates NANs when the result of an operation cannot be represented in
  20369.    the IEEE format. For example, if you try to add two positive numbers whose
  20370.    sum is larger than the maximum value supported by the data type, the
  20371.    coprocessor returns a NAN instead of the sum.
  20372.  
  20373.  near address
  20374.    A memory location specified by using only the offset from the start of the
  20375.    segment. A near address requires only two bytes. See "far address."
  20376.  
  20377.  null pointer
  20378.    A pointer to nothing, expressed as the integer value 0.
  20379.  
  20380.  object file
  20381.    A file (with the extension .OBJ) containing relocatable machine code
  20382.    produced by compiling a program and used by the linker to form an
  20383.    executable file.
  20384.  
  20385.  object module
  20386.    The contents of an object file after the file has been made part of a
  20387.    stand-alone library.
  20388.  
  20389.  object range
  20390.    See "address range."
  20391.  
  20392.  offset
  20393.    The number of bytes from the beginning of a segment in memory to a
  20394.    particular byte in that segment.
  20395.  
  20396.  output screen
  20397.    The screen where program output is shown. The Screen Exchange command (\),
  20398.    Output from the View menu, and the F4 key can be used to switch to this
  20399.    screen. The output screen is the same as it would be if you ran the
  20400.    debugged program outside of the CodeView debugger.
  20401.  
  20402.  parent process
  20403.    A process that creates another process, called the child process.
  20404.  
  20405.  PID (Process Identification Number)
  20406.    A unique code that OS/2 assigns to a process when the process is created.
  20407.    The PID may be any value except 0.
  20408.  
  20409.  pointer
  20410.    A variable containing the address of another variable. See "mouse
  20411.    pointer."
  20412.  
  20413.  popup menu
  20414.    A menu that pops up when you point the mouse cursor to the menu title and
  20415.    press a mouse button. In the CodeView debugger, popup menus also pop up
  20416.    when you press the ALT key and the first letter of the menu title at the
  20417.    same time. You can make a selection from the menu by dragging the
  20418.    highlight up or down with the mouse, by pressing the UP or DOWN direction
  20419.    key to move the highlight, or by pressing the ALT key and the first letter
  20420.    of the selection title at the same time.
  20421.  
  20422.  port
  20423.    The electrical connection through which the computer sends and receives
  20424.    data to and from devices or other computers.
  20425.  
  20426.  precedence
  20427.    The relative position of an operator in the hierarchy that determines the
  20428.    order in which expressions are evaluated.
  20429.  
  20430.  printf
  20431.    A function in the C standard library that prints formatted output
  20432.    according to instructions supplied with a type-specifier argument. The
  20433.    CodeView debugger uses a subset of the printf type specifiers to format
  20434.    expression values.
  20435.  
  20436.  privilege mode
  20437.    A special execution mode (also known as ring 0) supported by the
  20438.    80286/80386 hardware. Code executing in this mode can execute restricted
  20439.    instructions that are used to manipulate key system structures and tables.
  20440.    Only the OS/2 kernel and device drivers run in this mode.
  20441.  
  20442.  procedure
  20443.    A general term for a SUB or FUNCTION.
  20444.  
  20445.  procedure call
  20446.    A call to a subroutine that performs a specific action. In assembly
  20447.    language (assembly mode), subroutines are called procedures. In C (source
  20448.    mode), subroutines are called functions.
  20449.  
  20450.  process
  20451.    The executing instance of a binary file. In OS/2, the terms task and
  20452.    process are used interchangeably. A process is the unit of ownership, and
  20453.    processes own resources such as memory, open files, dynlink libraries, and
  20454.    semaphores.
  20455.  
  20456.  processor
  20457.    See "CPU."
  20458.  
  20459.  program step
  20460.    To trace the next source line in source mode or the next instruction in
  20461.    assembly mode. If the source line or instruction contains a function,
  20462.    procedure, or interrupt call, the call is executed to the end and the
  20463.    CodeView debugger is ready to execute the instruction after the call. See
  20464.    "trace."
  20465.  
  20466.  protected mode
  20467.    The operating mode of the 80286 or 80386 microprocessor that allows the
  20468.    operating system to use features that protect one application from another
  20469.    (also called protect mode). Protected mode in OS/2 supports multitasking
  20470.    and a whole range of special services not supported in DOS.
  20471.  
  20472.  radix
  20473.    The number system in which numbers are specified. In the CodeView
  20474.    debugger, numbers can be entered in three radixes: 8 (octal), 10
  20475.    (decimal), or 16 (hexadecimal). The default radix is 10.
  20476.  
  20477.  real mode
  20478.    The operating mode of the 80286 or 80386 microprocessor that runs programs
  20479.    designed for the 8086/8088 microprocessor. All programs for the DOS
  20480.    environment run in real mode.
  20481.  
  20482.  redirection
  20483.    To specify the device from which a program will receive input or to which
  20484.    it will send output. Normally program input comes from the keyboard, and
  20485.    program output goes to the screen. Redirection involves specifying a
  20486.    device (or file) other than the default device. In the MS-DOS operating
  20487.    system, input is redirected with the less-than symbol (<) and output is
  20488.    redirected with the greater-than symbol (>). The same symbols are used in
  20489.    the CodeView debugger to redirect input or output of the debugging
  20490.    session. In addition, the equal sign (=) can be used to redirect both
  20491.    input and output.
  20492.  
  20493.  register window
  20494.    The optional window in which the central processing unit (CPU) registers
  20495.    and the bits of the flag register are displayed.
  20496.  
  20497.  registers
  20498.    Special memory within the processor, where byte- or word-sized data can be
  20499.    stored during machine-level processing. The registers used with the 8086
  20500.    family of processors are: AX, BX, CX, DX, SP, BP, SI, DI, DS, ES, SS, CS,
  20501.    IP, and the flags register. See "flags."
  20502.  
  20503.  regular expressions
  20504.    A system of specifying text patterns that match variable text strings. The
  20505.    CodeView debugger supports a subset of the regular-expression characters
  20506.    used in the XENIX and UNIX operating systems. Regular expressions can be
  20507.    used to find strings in source files.
  20508.  
  20509.  routine
  20510.    A procedure, function, or subroutine residing in a module, and usually
  20511.    carrying out a specific task.
  20512.  
  20513.  run-time library
  20514.    A file containing standard functions for programs written in the Microsoft
  20515.    C language.
  20516.  
  20517.  scope
  20518.    The parts of a program in which a given symbol has meaning. The scope of
  20519.    an item may be limited to the file, function, block, or function prototype
  20520.    in which it appears.
  20521.  
  20522.  screen exchange
  20523.    The method by which both the output screen and the debugging screen are
  20524.    kept in memory so that both can be updated simultaneously and either
  20525.    viewed at the user's convenience. The two screen-exchange modes are
  20526.    flipping and swapping. See "flipping" and "swapping."
  20527.  
  20528.  scroll
  20529.    To move text up and down, or left and right, in order to see parts that
  20530.    cannot fit on the screen.
  20531.  
  20532.  segment
  20533.    An area of memory, less than or equal to 64K, containing code or data.
  20534.  
  20535.  semaphore
  20536.    A software flag or signal used to coordinate the activities of two or more
  20537.    threads. A semaphore is commonly used to protect a critical section.
  20538.  
  20539.  sequential mode
  20540.    The mode in which all CodeView output is sequential and no windows are
  20541.    available. Input and output scroll down the screen and the old output
  20542.    scrolls off the top of the screen when the screen is full. You cannot
  20543.    examine previous commands after they scroll off the top. This mode is
  20544.    required with computers that are not IBM compatible. The mouse and most
  20545.    window commands are not supported in sequential mode. Any debugging
  20546.    operation that can be done in window mode can also be done in sequential
  20547.    mode.
  20548.  
  20549.  shell escape
  20550.    A method of leaving the CodeView debugger without losing the current
  20551.    debugging context. You can "escape to a shell," do various MS-DOS tasks,
  20552.    and then return to the debugger. The debugging screen will be the same as
  20553.    when you left it. The CodeView debugger creates the shell by saving all
  20554.    current operations to memory and invoking a second copy of COMMAND.COM.
  20555.  
  20556.  single precision
  20557.    A real (floating-point) value that occupies four bytes of memory.
  20558.    Single-precision values are accurate to seven decimal places.
  20559.  
  20560.  source file
  20561.    A text file containing BASIC or C-language code.
  20562.  
  20563.  source mode
  20564.    The mode in which the CodeView debugger displays C source code to
  20565.    represent the code being executed.
  20566.  
  20567.  stack
  20568.    A dynamically shrinking and expanding area of memory in which data items
  20569.    are stored in consecutive order and removed on a last-in, first-out basis.
  20570.    The stack is most commonly used to store information for function and
  20571.    procedure calls and for local variables.
  20572.  
  20573.  stack frame
  20574.    A portion of a program's stack that contains a procedure's local variables
  20575.    and parameters. (In protected mode, each thread has its own stack.)
  20576.  
  20577.  stack trace
  20578.    A symbolic representation of the functions that have been executed to
  20579.    reach the current instruction address. As a function is executed, the
  20580.    function address and any function arguments are pushed on the stack (the
  20581.    area of memory starting at the address of the SS register). Therefore, a
  20582.    trace of the stack always shows the currently active functions and the
  20583.    values of their arguments.
  20584.  
  20585.  standard output
  20586.    The device to which a program sends its output unless the output is
  20587.    redirected. In normal DOS operation, standard output is the video display.
  20588.  
  20589.  start-up code
  20590.    The code that the C compiler places at the beginning of every program to
  20591.    control execution of the program code. When the CodeView debugger is
  20592.    loaded, the first source line executed runs the entire start-up code. If
  20593.    you switch to assembly mode before executing any code, you can trace
  20594.    through the start-up code.
  20595.  
  20596.  static linking
  20597.    The combining of multiple compilands into a single executable file,
  20598.    thereby resolving undefined external references.
  20599.  
  20600.  string
  20601.    A contiguous sequence of characters, often identified by a symbolic name.
  20602.    In this example, Hello is a string: PRINT "Hello". A string may be a
  20603.    constant or a variable.
  20604.  
  20605.  structure
  20606.    A set of elements, which may be of different types, grouped under a single
  20607.    name.
  20608.  
  20609.  structure member
  20610.    One of the elements of a structure.
  20611.  
  20612.  subroutine
  20613.    A unit of BASIC code terminated by the RETURN statement. Program control
  20614.    is transferred to a subroutine with a GOSUB statement.
  20615.  
  20616.  swapping
  20617.    A screen-exchange method that uses buffers to store the debugging and
  20618.    output screens. When you request the other screen, the two buffers are
  20619.    exchanged. This method is slower than flipping, the other screen-exchange
  20620.    method, but it works with any adapter and any type of program. See
  20621.    "flipping" and "screen exchange."
  20622.  
  20623.  symbol
  20624.    A name that identifies a location in memory. The terms "symbol" and
  20625.    "identifier" are used synonymously in CodeView documentation.
  20626.  
  20627.  temporary file
  20628.    A file that DOS may create when told to redirect command input or output.
  20629.    The file is deleted by DOS when the command is completed.
  20630.  
  20631.  thread
  20632.    The OS/2 mechanism that allows more than one path of execution through the
  20633.    same instance of an application program.
  20634.  
  20635.  thread ID
  20636.    The handle of a particular thread within a process.
  20637.  
  20638.  thread of execution
  20639.    The passage of the CPU through the instruction sequence. In DOS, each
  20640.    program has only one thread of execution.
  20641.  
  20642.  toggle
  20643.    A function key or menu selection that switches between two (and in some
  20644.    cases three) states. When used as a verb, toggle means to reverse the
  20645.    status of a feature. For example, the F3 key is a toggle that switches
  20646.    between source, mixed,  and assembly modes. You can press the F3 key to
  20647.    toggle between the three modes.
  20648.  
  20649.  trace
  20650.    To trace the next source line in source mode, or the next instruction in
  20651.    assembly mode. If the source line or instruction contains a function,
  20652.    procedure, or interrupt call, the first source line or instruction of the
  20653.    call is executed. The CodeView debugger is ready to execute the next
  20654.    instruction inside the call. See "program step."
  20655.  
  20656.  tracepoint
  20657.    A variable breakpoint that is taken when a specified value changes. The
  20658.    value to be tested can be either the value of a CodeView expression, or
  20659.    any of the bytes in a range of memory. Tracepoints can slow program
  20660.    execution significantly, since the CodeView debugger has to check after
  20661.    executing each source line in source mode or after each instruction in
  20662.    assembly mode to see if the value has changed. See "breakpoint."
  20663.  
  20664.  type cast
  20665.    An operation in which an operand of one type is converted to an operand of
  20666.    a different type.
  20667.  
  20668.  type casting
  20669.    To specify a type specifier in parentheses preceding an expression to
  20670.    indicate the type of the expression's value. For example, if x and y are
  20671.    integer values with the values 5 and 2 respectively, the expression x/y
  20672.    indicates integer division and the expression has the value 2. The
  20673.    expression (float)x/y indicates real-number division and has the value
  20674.    2.5.
  20675.  
  20676.  unary operator
  20677.    An operator that takes a single operand. Unary operators in the C language
  20678.    are the complement operators (- ~ !), indirection operator (*), increment
  20679.    (++) and decrement (--) operators, address-of operator (&), and sizeof
  20680.    operator. The unary plus operator (+) is also implemented syntactically,
  20681.    but has no semantics associated with it.
  20682.  
  20683.  unresolved external
  20684.    A symbol referenced in one assembly-language module, but not made PUBLIC
  20685.    in another module that is linked with it. Unresolved external references
  20686.    are usually caused by misspellings or by omitting the name of the module
  20687.    containing the desired symbol from the link command line.
  20688.  
  20689.  user-defined type
  20690.    A composite data structure in BASIC that can contain both string and
  20691.    numeric variables, similar to a C-language structure or Pascal record.
  20692.    User-defined types are defined with TYPE statements. The data structure is
  20693.    defined by a TYPE...END TYPE statement.
  20694.  
  20695.  watch window
  20696.    The window where watch statements and their values are displayed. The
  20697.    three kinds of watch statements are watch expressions, watchpoints, and
  20698.    tracepoints.
  20699.  
  20700.  watchpoint
  20701.    A variable breakpoint that is taken when a specified expression becomes
  20702.    nonzero (true). Watchpoints can slow program execution significantly,
  20703.    since the CodeView debugger has to check after executing each source line
  20704.    in source mode or after each instruction in assembly mode to see if the
  20705.    value is true. See "breakpoint."
  20706.  
  20707.  wildcard character
  20708.    A special character that, like the wild card in a poker game, can be used
  20709.    to represent any other character. DOS recognizes two wildcard characters:
  20710.    the question mark (?), which can represent any single character, and the
  20711.    asterisk (*), which can represent more than one character.
  20712.  
  20713.  window
  20714.    A term that refers to an area on the screen used either to display part of
  20715.    a file or to enter statements.
  20716.  
  20717.  window commands
  20718.    Commands that work only in the CodeView debugger's window mode. Window
  20719.    commands consist of function keys, mouse selection, CTRL and ALT key
  20720.    combinations, and selections from popup menus.
  20721.  
  20722.  window mode
  20723.    The mode in which the CodeView debugger displays separate windows, which
  20724.    can change independently. The debugger has mouse support and a wide
  20725.    variety of window commands in window mode.
  20726.  
  20727.  
  20728.  Index
  20729.  ───────────────────────────────────────────────────────────────────────────
  20730.  
  20731.  & (ampersand), LIB command symbol
  20732.  * (asterisk)
  20733.       Comment command
  20734.       FORTRAN multiplication operator
  20735.       LIB command symbol
  20736.       regular expressions, used in
  20737.  ** (asterisks), FORTRAN exponentiation operator
  20738.  @ (at sign)
  20739.       NMAKE special character
  20740.       Redraw command
  20741.       register prefix
  20742.  \ (backslash)
  20743.       NMAKE continuation character
  20744.       Screen Exchange command
  20745.  {} (braces), NMAKE character
  20746.  [] (brackets), regular expressions, used in
  20747.  ^ (caret)
  20748.       exponentiation operator, BASIC
  20749.       NMAKE escape character
  20750.  : (colon)
  20751.       Delay command
  20752.       LINK command
  20753.       NMAKE separator
  20754.       operator
  20755.  , (comma)
  20756.       LIB command symbol
  20757.       LINK command symbol
  20758.  - (dash)
  20759.       regular expressions, used in
  20760.       NMAKE special character
  20761.  $ (dollar sign)
  20762.       NMAKE macros, used in
  20763.       regular expressions, used in
  20764.  :: (double colon), NMAKE separator
  20765.  = (equal sign)
  20766.       assignment operator, FORTRAN
  20767.       Redirected Input and Output command
  20768.  ! (exclamation point)
  20769.       NMAKE directives, used in
  20770.       NMAKE special character
  20771.       Shell Escape command
  20772.  / (forward slash)
  20773.       CodeView option designator
  20774.       LINK option character
  20775.       Search command
  20776.  > (greater-than sign)
  20777.       CodeView prompt
  20778.       Redirected Output command
  20779.  < (less-than sign), Redirected Input command
  20780.  - (minus sign)
  20781.       FORTRAN
  20782.  -* (minus sign-asterisk), LIB command symbol
  20783.  -+ (minus sign-plus sign), LIB command symbol
  20784.  # (number sign)
  20785.       NAN (not a number)
  20786.       NMAKE comment character
  20787.       Tab Set command
  20788.  () (parentheses), FORTRAN operator
  20789.  . (period)
  20790.       Current Location command
  20791.       operator
  20792.            C
  20793.       regular expressions, used in
  20794.  + (plus sign)
  20795.       LIB command symbol
  20796.            Intel, XENIX files, used with
  20797.            libraries, combining and specifying
  20798.            object files, appending
  20799.            using
  20800.       LINK command symbol
  20801.  "" (quotation marks), Pause command
  20802.  ; (semicolon)
  20803.       LINK command symbol
  20804.       LIB command symbol
  20805.       LINK command symbol
  20806.       NMAKE command separator
  20807.  _ (underscore), symbol names, used in
  20808.  /2 option, CodeView
  20809.  7 (8087 command)
  20810.  10-byte reals, dumping
  20811.  /43 option, CodeView
  20812.  /50 option, CodeView
  20813.  386 option
  20814.  8087
  20815.       command
  20816.       coprocessor
  20817.       stack
  20818.  8259 trapping
  20819.  
  20820.  A
  20821.  ───────────────────────────────────────────────────────────────────────────
  20822.  
  20823.  A (Assemble command)
  20824.  /A option
  20825.       LINK
  20826.       NMAKE
  20827.  /a option, ILINK
  20828.  Absolute addresses
  20829.  Accessing bytes
  20830.  Adapters, using two
  20831.  Addresses
  20832.       absolute
  20833.       full
  20834.       segment start
  20835.  /ALIGNMENT option, LINK
  20836.  Alignment types
  20837.  Ampersand (&), LIB command symbol
  20838.  .AND. operator
  20839.  API.LIB
  20840.  APILMR.OBJ
  20841.  Application import libraries
  20842.  Archives, XENIX
  20843.  Arguments
  20844.       CodeView
  20845.            dialog commands
  20846.            program
  20847.       LINK options
  20848.       program
  20849.       routine
  20850.  Arrays
  20851.       copying
  20852.       multidimensional, and BASIC
  20853.  AS, NMAKE macro
  20854.  ASCII characters, displayed by CodeView
  20855.  Assemble command
  20856.  Assembly
  20857.       address
  20858.       mode
  20859.            example
  20860.            setting
  20861.            using
  20862.       rules
  20863.  Assembly, programs. See Macro Assembler
  20864.  Assignment operator
  20865.       BASIC
  20866.       FORTRAN
  20867.  Asterisk (*), comment command symbol
  20868.  At sign (@)
  20869.       NMAKE special character
  20870.       Redraw command
  20871.       register prefix
  20872.  Attributes. See Segment attributes
  20873.  
  20874.  B
  20875.  ───────────────────────────────────────────────────────────────────────────
  20876.  
  20877.  /B option
  20878.       CodeView
  20879.       LINK
  20880.       NMAKE
  20881.  /BA option, LINK
  20882.  Backslash (\), Screen Exchange command
  20883.  BASIC
  20884.       colon (:) operator
  20885.       constants
  20886.       expression evaluator
  20887.       expressions
  20888.       intrinsic functions
  20889.       programs
  20890.            CodeView, preparing for
  20891.            compiling and linking
  20892.            source code, writing
  20893.       strings
  20894.       symbols
  20895.  /BATCH option, (/BA), LINK
  20896.  Batch files, exit codes
  20897.  BC (Breakpoint Clear Command)
  20898.  BD (Breakpoint Disable command)
  20899.  BE (Breakpoint Enable command)
  20900.  BEGDATA class name
  20901.  /BINARY option (/BI), LINK
  20902.  BIND
  20903.       command line
  20904.       described
  20905.       options
  20906.  BL (Breakpoint List command)
  20907.  Black-and-white display, CodeView
  20908.  Blocks of memory
  20909.       copying
  20910.       filling
  20911.       moving
  20912.  BP. See Breakpoint Set command
  20913.  Braces ({}), NMAKE character
  20914.  Brackets ([]), regular expressions, used in
  20915.  Breakpoint Clear command
  20916.       Run menu selection
  20917.       using
  20918.  Breakpoint Disable command
  20919.  Breakpoint Enable command
  20920.  Breakpoint List command
  20921.  Breakpoint Set command
  20922.       F9 function key
  20923.       mouse, executing with
  20924.       using
  20925.  Breakpoints
  20926.       address
  20927.       conditional
  20928.       defined
  20929.       deleting
  20930.       displaying
  20931.       Go command, used with
  20932.       listing
  20933.  BSS class name
  20934.  Buffer, CodeView command
  20935.  BY operator
  20936.  
  20937.  C
  20938.  ───────────────────────────────────────────────────────────────────────────
  20939.  
  20940.  C language
  20941.       CodeView, case sensitivity
  20942.       constants
  20943.       expressions
  20944.       operators
  20945.       programs
  20946.            CodeView, preparing for
  20947.            compiling and linking
  20948.            macros
  20949.            writing source
  20950.       strings
  20951.       symbols
  20952.  /C option
  20953.       CodeView
  20954.       NMAKE
  20955.  /c option, ILINK
  20956.  Calling conventions
  20957.  Calls
  20958.       menu
  20959.       stepping over
  20960.       tracing into
  20961.  Canonical frame number. See Frame number
  20962.  Caret (^)
  20963.       exponentiation operator, BASIC
  20964.       NMAKE escape character
  20965.       regular expressions, used in
  20966.  Case sensitivity
  20967.       BASIC-expression evaluator
  20968.       C symbols
  20969.       CodeView
  20970.       FORTRAN symbols
  20971.       LINK
  20972.       Macro Assembler options
  20973.  CL driver
  20974.  Class names
  20975.       BEGDATA
  20976.       CODE
  20977.       linking procedure, used in
  20978.       STACK
  20979.  Class names
  20980.  Class types
  20981.  Click, defined
  20982.  !CMDSWITCHES directive, NMAKE
  20983.  /CO linker option
  20984.  /CO option, LINK
  20985.  CODE class name
  20986.  CODE statement
  20987.  Code symbol, defined
  20988.  CodeView
  20989.       case sensitivity
  20990.       colon (:) operator
  20991.       command line
  20992.       compatibility
  20993.       compiler options
  20994.            /D
  20995.            /Od
  20996.            /Zd
  20997.            /Zi
  20998.       defaults
  20999.       EGA compatibility
  21000.       executable files
  21001.       exit codes
  21002.       interrupt program execution
  21003.       language support
  21004.            BASIC
  21005.            C
  21006.            FORTRAN
  21007.            Macro Assembler
  21008.       linker option (/CO)
  21009.       mixed-language support
  21010.       operators
  21011.            BY
  21012.            DW
  21013.            memory
  21014.            WO
  21015.       optimization, effect of
  21016.       options
  21017.            /C
  21018.            command line, used in
  21019.            described
  21020.            /L
  21021.            /O
  21022.            summary
  21023.       parameters, program
  21024.       period operator (.)
  21025.       restrictions
  21026.       source-module files, location of
  21027.       start-up
  21028.            command line
  21029.            commands
  21030.            file configuration
  21031.       symbolic information
  21032.       symbols
  21033.       syntax, summary
  21034.  /CODEVIEW option, LINK
  21035.  Colon (:)
  21036.       Delay command
  21037.       NMAKE separator
  21038.       operator
  21039.  Color graphics adapter (CGA)
  21040.  .COM extension, debugged files, used for
  21041.  Combine types
  21042.       COMMON
  21043.       PRIVATE
  21044.       PUBLIC
  21045.       STACK
  21046.  Command buffer
  21047.  Command line
  21048.       BIND
  21049.       CodeView
  21050.       ILINK
  21051.       IMPLIB
  21052.       LIB
  21053.       LINK
  21054.       NMAKE
  21055.  COMMAND.COM, Shell command, used with
  21056.  Commands, CodeView
  21057.       8087 command
  21058.       Assemble
  21059.       Breakpoint Clear
  21060.            Run menu selection
  21061.            using
  21062.       Breakpoint Disable
  21063.       Breakpoint Enable
  21064.       Breakpoint List
  21065.       Breakpoint Set
  21066.            F9 function key
  21067.            mouse, executing with
  21068.            using
  21069.       calls
  21070.            stepping over
  21071.            tracing through
  21072.       command buffer
  21073.       Comment
  21074.       Current Location
  21075.       cursor movement
  21076.       Delay
  21077.       dialog commands
  21078.       Display Expression
  21079.       Dump
  21080.            10-Byte Reals
  21081.            ASCII
  21082.            Bytes
  21083.            default size
  21084.            Double Words
  21085.            Integers
  21086.            Long Reals
  21087.            Short Reals
  21088.            Unsigned Integers
  21089.            Words
  21090.       Enter
  21091.            ASCII
  21092.            Bytes
  21093.            default size
  21094.            Double Words
  21095.            Integers
  21096.            Long Reals
  21097.            Short Reals
  21098.            Unsigned Integers
  21099.            using
  21100.            Words
  21101.       ESCAPE key
  21102.       Examine Symbols
  21103.       Execute
  21104.       Exit
  21105.       Expression
  21106.       Fill Memory
  21107.       Go
  21108.            destination address
  21109.            F5 function key
  21110.            mouse, executing with
  21111.            using
  21112.       Goto
  21113.            comment line
  21114.            F5 function key
  21115.            mouse, executing with
  21116.            using
  21117.       grow (increase) window size
  21118.       Help
  21119.            F1 function key
  21120.            menu
  21121.            using
  21122.            window mode
  21123.       input, redirecting
  21124.       mnemonic keys
  21125.       Move Memory
  21126.       Option
  21127.       Output
  21128.       output, redirecting
  21129.       Pause
  21130.       Port Output
  21131.       Program Step
  21132.            F10 function key
  21133.            using
  21134.       Quit
  21135.       Radix setting
  21136.       Redirected Input and Output
  21137.       Redraw
  21138.       Registers
  21139.            displaying
  21140.            F2 function key
  21141.            mouse, executing with
  21142.            values, changing
  21143.            View menu selection
  21144.       Restart
  21145.            Run menu selection
  21146.            using
  21147.       Screen Exchange
  21148.            F4 function key
  21149.            using
  21150.       scroll
  21151.            line down
  21152.            line up
  21153.            page down
  21154.            page up
  21155.            to bottom
  21156.            to top of page
  21157.            to top
  21158.       Search
  21159.            menu selections
  21160.            regular expressions, used with
  21161.            using
  21162.       separator line movement
  21163.       separator line
  21164.            movement
  21165.       Set Mode
  21166.            dialog command
  21167.            F3 function key
  21168.            View menu selection
  21169.       Shell Escape
  21170.            File menu selection
  21171.            using
  21172.       Stack Trace
  21173.            display contents
  21174.            using
  21175.       T (Trace command)
  21176.       Tab Set
  21177.       tiny (reduce) window size
  21178.       Trace
  21179.            F8 function key
  21180.            using
  21181.       Tracepoint
  21182.       tracing into calls
  21183.       Unassemble
  21184.       View
  21185.       Watch Delete All
  21186.       Watch Delete
  21187.       Watch expression
  21188.       Watch List
  21189.       Watch
  21190.            menu selections
  21191.            sequential mode
  21192.       Watchpoint
  21193.            setting
  21194.            Watch menu selection
  21195.       window
  21196.  Commands, NMAKE description file
  21197.  Comment command
  21198.  Comment lines, source code
  21199.  Comments, NMAKE description file
  21200.  COMMON combine type
  21201.  Compiler errors and CodeView
  21202.  Compiler options
  21203.       /Od
  21204.       /Zd
  21205.       /Zi
  21206.  COMSPEC environment variable
  21207.  Concatenation, string, BASIC
  21208.  Conditional breakpoints
  21209.  Conjunction operator
  21210.  Consistency checking, LIB
  21211.  Constant expressions
  21212.  Constant numbers
  21213.       BASIC
  21214.       C
  21215.       FORTRAN
  21216.  CONTROL+BREAK
  21217.  CONTROL+C
  21218.  CONTROL+F (Find command)
  21219.  CONTROL+G (grow window size)
  21220.  CONTROL+T (tiny window size)
  21221.  CONTROL+U (Delete Watch command)
  21222.  CONTROL+W (Add Watch command)
  21223.  Controlling
  21224.       data loading
  21225.       executable-file loading
  21226.       LINK
  21227.       segments, number of
  21228.       stack size
  21229.  Copying arrays
  21230.  /CP option, LINK
  21231.  /CPARMAXALLOC option, LINK
  21232.  Cross-reference listing, LIB
  21233.  CTRLEND key (scroll to bottom)
  21234.  CTRLHOME key (scroll to top)
  21235.  Current Location command
  21236.  Current location line
  21237.  Cursor, CodeView
  21238.  CV.EXE, location of
  21239.  CV.HLP, location of
  21240.  
  21241.  D
  21242.  ───────────────────────────────────────────────────────────────────────────
  21243.  
  21244.  D (Dump command)
  21245.  /D option
  21246.       Compiler
  21247.       NMAKE
  21248.  DA (Dump ASCII command)
  21249.  Dash (-), command-line options
  21250.  Data segments, loading
  21251.  DATA statement
  21252.  Data symbol, defined
  21253.  DB (Dump Bytes command)
  21254.  DD (Dump Double Words command)
  21255.  DEBUG
  21256.  Debugging, preparing for, (/CODEVIEW option)
  21257.  Decimal notation
  21258.       BASIC
  21259.       C
  21260.       FORTRAN
  21261.  Default data segment
  21262.  Defaults, CodeView
  21263.       address-range size
  21264.       expression format
  21265.       IBM Personal Computer, used with
  21266.       radix
  21267.       segment
  21268.       start-up behavior
  21269.       type
  21270.            Dump command
  21271.            Enter command
  21272.            Watch command
  21273.  Defaults, utilities
  21274.       libraries, ignoring
  21275.       NMAKE, MAKEFILE
  21276.       responses
  21277.            LIB
  21278.            LINK
  21279.  Definitions
  21280.       code symbol
  21281.       data symbol
  21282.       logical segment
  21283.       memory model
  21284.       module
  21285.       physical segment
  21286.       segment
  21287.  Delay command
  21288.  Dependency lines
  21289.  Dependents
  21290.       directory searches
  21291.       macros for
  21292.       specifying
  21293.  Description blocks
  21294.       described
  21295.       inference rules used with
  21296.       multiple for one target
  21297.  Description files, NMAKE
  21298.       comments
  21299.       described
  21300.       macro definitions in
  21301.       MAKEFILE
  21302.       specifying
  21303.  DESCRIPTION statement
  21304.  Destination address, Go command, used with
  21305.  DGROUP
  21306.       memory, allocating below
  21307.       segment order
  21308.  DI (Dump Integers command)
  21309.  Dialog
  21310.       box
  21311.       commands
  21312.       window
  21313.  Directives NMAKE
  21314.       !CMDSWITCHES
  21315.       !ERROR
  21316.       !INCLUDE
  21317.       described
  21318.       !ELSE
  21319.       !ENDIF
  21320.       !IF
  21321.       !IFDEF
  21322.       !IFNDEF
  21323.       !UNDEF
  21324.  Disjunction, inclusive
  21325.  Display, CodeView
  21326.       assembly mode
  21327.       CONTROL+G (grow window size)
  21328.       CONTROL+T (tiny window size)
  21329.       CTRLEND key (scroll to bottom)
  21330.       CTRLHOME key (scroll to top)
  21331.       cursor
  21332.       dialog box
  21333.       display mode
  21334.       DOWN ARROW key (cursor down)
  21335.       END key (scroll to bottom of a page)
  21336.       highlight
  21337.       HOME key (scroll to top of page)
  21338.       menu bar
  21339.       message box
  21340.       mouse pointer
  21341.       output screen
  21342.       PGDN key (scroll page down)
  21343.       PGUP key (scroll page up)
  21344.       register window
  21345.       scroll bar
  21346.       separator line
  21347.       set mode command
  21348.       UP ARROW key (cursor up)
  21349.       window
  21350.  Display Expression command
  21351.  Display mode
  21352.  DL (Dump Long Reals command)
  21353.  /DO option, LINK
  21354.  Dollar sign ($)
  21355.       NMAKE macros, used in
  21356.       regular expressions, used in
  21357.  DOS, program header
  21358.  DOSCALLS.LIB
  21359.  /DOSSEG option, LINK
  21360.  Double Words (units of memory)
  21361.  DOWN ARROW key (cursor down)
  21362.  Drag, defined
  21363.  Drivers
  21364.       CL
  21365.       FL
  21366.  DS (Dump Short Reals command)
  21367.  /DS option, LINK
  21368.  DS register, described
  21369.  /DSALLOCATE option, LINK
  21370.  DT (Dump 10-Byte Reals command)
  21371.  DU (Dump Unsigned Integers command)
  21372.  Dump address
  21373.  Dump commands
  21374.       10-Byte Reals
  21375.       ASCII
  21376.       Bytes
  21377.       default size
  21378.       Double Words
  21379.       Integers
  21380.       Long Reals
  21381.       Short Reals
  21382.       Unsigned Integers
  21383.       using
  21384.       Words
  21385.  DW (Dump Words command)
  21386.  DW operator
  21387.  Dynamic-link function calls
  21388.  Dynamic-link libraries
  21389.  
  21390.  E
  21391.  ───────────────────────────────────────────────────────────────────────────
  21392.  
  21393.  E commands
  21394.       Enter
  21395.       Execute
  21396.  /E option,
  21397.       CodeView
  21398.       LINK
  21399.       NMAKE
  21400.  /e option, ILINK
  21401.  EA (Enter ASCII command)
  21402.  EB (Enter Bytes command)
  21403.  Echo, redirection, used with
  21404.  ED (Enter Double Words command)
  21405.  _edata
  21406.  EGA (Enhanced Graphics Adapter)
  21407.  EI (Enter Integers command)
  21408.  EL (Enter Long Reals command)
  21409.  !ELSE directive, NMAKE
  21410.  _end
  21411.  End (special variable)
  21412.  END key (scroll to bottom)
  21413.  !ENDIF directive, NMAKE
  21414.  Enhanced graphics adapter (EGA)
  21415.  Enter commands
  21416.       ASCII
  21417.       Bytes
  21418.       default size
  21419.       Double Words
  21420.       Integers
  21421.       Long Reals
  21422.       Short Reals
  21423.       Unsigned Integers
  21424.       using
  21425.       Words
  21426.  Environment
  21427.       enlarging
  21428.       variables
  21429.            LIB
  21430.            LINK
  21431.            TMP, used by LINK
  21432.  Equal sign (=)
  21433.       Redirected Input and Output command
  21434.  .EQV. operator
  21435.  !ERROR directive, NMAKE
  21436.  Error handling, NMAKE
  21437.  Error messages
  21438.       EXEMOD
  21439.       ILINK
  21440.       LIB
  21441.       LINK
  21442.       NMAKE
  21443.       SETENV
  21444.  Errorlevel codes. See Exit codes
  21445.  Errors, logic and syntax
  21446.  ES (Enter Short Reals command)
  21447.  Escape character, NMAKE
  21448.  ESCAPE key
  21449.  EU (Enter Unsigned Integers command)
  21450.  EW (Enter Words command)
  21451.  Examine Symbols command
  21452.  Exclamation point (!)
  21453.       NMAKE directives, used in
  21454.       NMAKE special character
  21455.       Shell Escape command
  21456.  .EXE extension
  21457.  EXE header information
  21458.  Executable files
  21459.       CodeView
  21460.            format
  21461.            start-up, required for
  21462.       command line, used in
  21463.       compressing
  21464.       extensions
  21465.       headers
  21466.            changing
  21467.            information
  21468.            size
  21469.       initial register values
  21470.       LINK
  21471.            naming with
  21472.            specifying with prompts
  21473.            specifying with response file
  21474.       load size
  21475.       loading
  21476.       location of
  21477.       maximum allocation
  21478.       minimum allocation
  21479.       naming, default
  21480.       overlay number
  21481.       packing
  21482.       protected-mode format
  21483.       segmented-executable format
  21484.       size
  21485.  Executable image
  21486.  Execute command
  21487.  EXEHDR
  21488.       command line
  21489.       described
  21490.       option, /v
  21491.  EXEMOD display
  21492.       initial instruction pointer
  21493.       initial register values
  21494.       initial stack pointer
  21495.       maximum allocation
  21496.       minimum allocation
  21497.       Overlay number
  21498.  EXEMOD
  21499.       described
  21500.       error messages
  21501.       exit codes
  21502.       /H option
  21503.       header information
  21504.       maximum allocation, changing
  21505.       /MAX option
  21506.       /MIN option
  21507.       /STACK option
  21508.  EXEPACK
  21509.       described
  21510.       exit codes
  21511.  /EXEPACK option, LINK
  21512.  EXETYPE statement
  21513.  Exit codes
  21514.       CodeView
  21515.       DOS batch files, with
  21516.       error level
  21517.       EXEMOD
  21518.       EXEPACK
  21519.       LINK
  21520.       NMAKE
  21521.       programs for
  21522.       SETENV
  21523.       using
  21524.  Exit, DOS command
  21525.  Exiting from LINK
  21526.  Expanded memory
  21527.  Exponentiation operator
  21528.       BASIC
  21529.       FORTRAN
  21530.  Export definitions
  21531.  EXPORTS statement
  21532.  Expression evaluation
  21533.       CodeView requirement
  21534.       Display Expression command
  21535.  Expressions
  21536.       BASIC
  21537.       C
  21538.       FORTRAN
  21539.       regular
  21540.            searches, used in
  21541.            specifying
  21542.  Extensions
  21543.       .SUFFIXES, listing with
  21544.       auto option
  21545.       default, LINK
  21546.       executable files
  21547.       libraries
  21548.            LIB, used with
  21549.            LINK, used with
  21550.       map files
  21551.       object files
  21552.  
  21553.  F
  21554.  ───────────────────────────────────────────────────────────────────────────
  21555.  
  21556.  F (Fill Memory command)
  21557.  /F option
  21558.       CodeView
  21559.       LINK
  21560.       NMAKE
  21561.  F1 key (Help)
  21562.  F2 key (Register)
  21563.  F3 key
  21564.       (Set source/assembly)
  21565.       (Set source/mixed/assembly)
  21566.  F4 key (Screen Exchange)
  21567.  F5 key (Go)
  21568.  F6 key (switch cursor)
  21569.  F7 key (Goto)
  21570.  F8 key (Trace)
  21571.  F9 key
  21572.       (Breakpoint Clear)
  21573.       (Breakpoint Enable)
  21574.       (Breakpoint Set)
  21575.  F10 key (Program Step)
  21576.  Family API
  21577.  Far-return mnemonic (RETF)
  21578.  /FARCALLTRANSLATION option, LINK
  21579.  Fatal Error messages, LINK
  21580.  Files, menu
  21581.       DOS Shell
  21582.       Exit
  21583.       Load
  21584.       Quit
  21585.       Shell
  21586.  Fill Memory command
  21587.  Fixups
  21588.  FL driver
  21589.  Flag bits
  21590.       mouse, changing with
  21591.       values
  21592.            changing
  21593.            displaying
  21594.  Flag mnemonics
  21595.  Flipping, CodeView
  21596.  Format specifiers
  21597.       prefixes
  21598.       summary
  21599.  FORTRAN
  21600.       CodeView
  21601.            case sensitivity
  21602.            support
  21603.       colon (:) operator
  21604.       compiler
  21605.       constants
  21606.       expression evaluator
  21607.       expressions
  21608.       identifiers
  21609.       include files
  21610.       intrinsic functions
  21611.       operators
  21612.       programs
  21613.            CodeView, preparing for
  21614.            writing source code
  21615.       strings
  21616.       symbols
  21617.  Forward slash (/)
  21618.       division operator, FORTRAN
  21619.       option character, LINK
  21620.       option designator
  21621.            CodeView
  21622.            compilers
  21623.       Search command
  21624.  Frame number
  21625.  Function calls
  21626.       stepping over
  21627.       tracing into
  21628.  Function keys
  21629.       F1 (Help)
  21630.       F2 (Register)
  21631.       F3
  21632.            (Set source/assembly)
  21633.            (Set source/mixed/assembly)
  21634.       F4
  21635.            (Screen Exchange)
  21636.       F5 (Go)
  21637.       F6 (Switch Cursor)
  21638.       F7 (Goto)
  21639.       F8 (Trace)
  21640.       F9
  21641.            (Breakpoint Clear)
  21642.            (Breakpoint Enable)
  21643.            (Breakpoint Set)
  21644.       F10 (Program Step)
  21645.  Functions
  21646.       binding
  21647.       calls to
  21648.       examining
  21649.       intrinsic
  21650.            BASIC
  21651.            FORTRAN
  21652.       viewing
  21653.  
  21654.  G
  21655.  ───────────────────────────────────────────────────────────────────────────
  21656.  
  21657.  G (Go command)
  21658.  .GE. operator
  21659.  Global symbols. See Public symbols
  21660.  Go command
  21661.       F5 function key
  21662.       mouse, executing with
  21663.       using
  21664.  Goto command
  21665.       comment line
  21666.       F7 function key
  21667.       mouse, executing with
  21668.       using
  21669.  Graphics adapters
  21670.       43-line mode
  21671.       EGA, compatibility
  21672.       screen-exchange mode
  21673.       using two
  21674.  Graphics programs, debugging
  21675.  Greater-than sign (>)
  21676.       CodeView prompt
  21677.       Redirected Output command
  21678.  Greater-than sign or equal to operator, FORTRAN
  21679.  Groups
  21680.       DGROUP
  21681.       linking procedures, used in
  21682.  .GT. operator
  21683.  
  21684.  H
  21685.  ───────────────────────────────────────────────────────────────────────────
  21686.  
  21687.  H (Help command)
  21688.  /H option, EXEMOD
  21689.  Hardware ports, output to
  21690.  /HE option, LINK
  21691.  Header information, EXE file
  21692.  HEAPSIZE statement
  21693.  Help command
  21694.       F1 function key
  21695.       help file
  21696.       shell command, used with
  21697.       using
  21698.       view menu selection
  21699.       window mode
  21700.  Help menu
  21701.  /HELP option, LINK
  21702.  Hexadecimal notation
  21703.       BASIC
  21704.       C
  21705.       FORTRAN
  21706.  /HI option, LINK
  21707.  /HIGH option, LINK
  21708.  Highlight
  21709.  HOME key (scroll to top)
  21710.  
  21711.  I
  21712.  ───────────────────────────────────────────────────────────────────────────
  21713.  
  21714.  /I option
  21715.       CodeView
  21716.       NMAKE
  21717.  /i option, ILINK
  21718.  IBM PC
  21719.       compatibility with CodeView
  21720.       recognizing CodeView
  21721.  Identifiers
  21722.       BASIC
  21723.       C
  21724.       FORTRAN
  21725.  !IF directive, NMAKE
  21726.  !IFDEF directive, NMAKE
  21727.  !IFNDEF directive, NMAKE
  21728.  .IGNORE pseudotarget
  21729.  ILINK
  21730.       command line
  21731.       described
  21732.       error messages
  21733.       guidelines
  21734.       incremental violations
  21735.  ILINK options
  21736.       /a
  21737.       /c
  21738.       /e
  21739.       /i
  21740.       /v
  21741.  ILINKSTB.OVL
  21742.  IMPLIB
  21743.       command line
  21744.       described
  21745.  Import
  21746.       definitions
  21747.       libraries
  21748.  IMPORTS statement
  21749.  /INC option, LINK
  21750.  !INCLUDE directive, NMAKE
  21751.  INCLUDE environment variable, NMAKE
  21752.  Include files
  21753.       assembly programs
  21754.       BASIC programs
  21755.       C programs
  21756.       CodeView
  21757.       FORTRAN programs
  21758.  Incremental linking. See ILINK
  21759.  /INCREMENTAL option, LINK
  21760.  Incremental violations, ILINK
  21761.  IND (indefinite)
  21762.  Indentation
  21763.  Indirect register instructions
  21764.  Indirection levels, CodeView
  21765.  #IND (indefinite)
  21766.  #INF (infinity)
  21767.  INF (infinity)
  21768.  /INF option, LINK
  21769.  Inference rules
  21770.  Infinity
  21771.  /INFORMATION option, LINK
  21772.  Initializing data
  21773.  Instruction, current
  21774.  Instruction-name synonyms
  21775.  Integers, dumping
  21776.  Interrupt, DOS functions
  21777.  Intrinsic functions
  21778.       BASIC
  21779.       FORTRAN
  21780.  Invoking, NMAKE
  21781.       command file
  21782.       command line
  21783.  
  21784.  K
  21785.  ───────────────────────────────────────────────────────────────────────────
  21786.  
  21787.  K (Stack Trace command)
  21788.  
  21789.  L
  21790.  ───────────────────────────────────────────────────────────────────────────
  21791.  
  21792.  /L option
  21793.       CodeView
  21794.       using
  21795.  L (Restart command)
  21796.  Labels, finding
  21797.  Less-than sign (<), Redirected Input command
  21798.  LET
  21799.  Levels of indirection, CodeView
  21800.  /LI option, LINK
  21801.  LIB
  21802.       addition commands
  21803.       backup library file
  21804.       changing with
  21805.       commands, specifying
  21806.       consistency checking
  21807.       creating
  21808.       default responses
  21809.       error messages
  21810.       extending lines
  21811.       files, listing
  21812.       input
  21813.       Intel
  21814.       libraries
  21815.            combining
  21816.            index
  21817.            modules, adding and deleting
  21818.            modulsymbol (<B
  21819.       listing files
  21820.       modules, extracting and deleting
  21821.       object modules, deleting
  21822.       operations, order of
  21823.       options, /PAGESIZE
  21824.       output
  21825.       running
  21826.            command line
  21827.            prompts
  21828.            response file
  21829.       terminating
  21830.       variable
  21831.  LIB command symbols
  21832.       asterisk (*)
  21833.       minus sign (-)
  21834.       minus sign-asterisk (-*)
  21835.       minus sign-plus sign (-+)
  21836.       plus sign (+)
  21837.            libraries, combining and specifying
  21838.            object files, appending
  21839.            using
  21840.  LIB options
  21841.       /NOEXTDICTIONARY (/NOI)
  21842.       /NOIGNORECASE (/NOI)
  21843.  
  21844.       /PAGESIZE
  21845.  Libraries
  21846.       application import
  21847.       automatic object-file processing
  21848.       development, used in
  21849.       dynamic link
  21850.       extensions
  21851.       import
  21852.       See Also LIB
  21853.       load
  21854.       mixed-language programming
  21855.       regular
  21856.       routines, binding
  21857.       search paths
  21858.       specifying
  21859.            LINK command line
  21860.            LINK prompts
  21861.            LINK response file
  21862.       standard places
  21863.  Library manager. See LIB
  21864.  LIBRARY statement
  21865.  Line numbers, in source-level debugging
  21866.  Line-number option, LINK
  21867.  /LINENUMBERS option, LINK
  21868.  LINK
  21869.       alignment types
  21870.       CodeView, used with
  21871.            C example
  21872.            FORTRAN example
  21873.            Macro Assembler example
  21874.       combine types
  21875.       defaults
  21876.            command line
  21877.            responses
  21878.       environment variable
  21879.       exit codes
  21880.       exiting from
  21881.       fatal error messages
  21882.       file-name conventions
  21883.       groups
  21884.       nonfatal error messages
  21885.       operation
  21886.       running
  21887.            LINK command line
  21888.            prompts
  21889.            response file
  21890.       temporary output file
  21891.       terminating
  21892.  LINK options
  21893.       abbreviations
  21894.       /ALIGNMENT (/A)
  21895.       /BATCH (/B)
  21896.       batch-file mode, running in
  21897.       case sensitivity
  21898.       /CODEVIEW (/CO)
  21899.       compatibility, preserving
  21900.       /CPARMAXALLOC (/CP)
  21901.       data loading
  21902.       debugging
  21903.       default libraries, ignoring
  21904.       /DOSSEG (/DO)
  21905.       /DSALLOCATE (/DS)
  21906.       environment variable, using
  21907.       executable files
  21908.            loading
  21909.            packing
  21910.       /EXEPACK (/E)
  21911.       /FARCALLTRANSLATION (/F)
  21912.       /HELP (/HE)
  21913.       /HIGH (/HI)
  21914.       /INCREMENTAL (/INC)
  21915.       /INFORMATION (/INF)
  21916.       line numbers, displaying
  21917.       /LINENUMBERS (/LI)
  21918.       LINK command line, specifying on
  21919.       LINK prompts, responding to
  21920.       linker prompting, preventing
  21921.       Listing
  21922.       /MAP (/M)
  21923.       map file
  21924.       /NOD, object files, used with
  21925.       /NOEXTDICTIONARY (/NOE)
  21926.       /NOFARCALLTRANSLATION (/NOF)
  21927.       /NOIGNORECASE (/NOI)
  21928.       /NONULLDOSSEG (/NON)
  21929.       /NOPACKCODE (/NOP)
  21930.       numerical arguments
  21931.       ordering segments
  21932.       overlay interrupt, setting
  21933.       /OVERLAYINTERRUPT (/O)
  21934.       /PACKDATA (/PACKDATA)
  21935.       /PADCODE (/PADC)
  21936.       /PADDATA (/PADD)
  21937.       paragraph space, allocating
  21938.       /PAUSE (/PAU)
  21939.       pausing
  21940.       process information, displaying
  21941.       producing a .COM file
  21942.       /QUICKLIB (/Q)
  21943.       /SEGMENTS (/SE)
  21944.       segments
  21945.       /STACK (/ST)
  21946.       stack size, setting
  21947.       /WARNFIXUP (/W)
  21948.  Linker utility. See LINK
  21949.  Listing files, LIB
  21950.  Load
  21951.       libraries, LINK command line
  21952.       menu selection
  21953.  Local variables
  21954.  Logical error
  21955.  Logical operator, FORTRAN
  21956.  Logical segment, defined
  21957.  Long reals
  21958.       dumping
  21959.       entering with CodeView
  21960.  Loops
  21961.       tracepoints, used with
  21962.       watchpoints, used with
  21963.  .LT. operator
  21964.  Lvalue
  21965.  
  21966.  M
  21967.  ───────────────────────────────────────────────────────────────────────────
  21968.  
  21969.  M (Move Memory command)
  21970.  /M option
  21971.       LINK
  21972.       CodeView
  21973.  /m option, BIND
  21974.  Macro Assembler
  21975.       assembling and linking
  21976.       older versions, with CodeView
  21977.  Macros
  21978.       $$@ macro
  21979.       $* macro
  21980.       $** macro
  21981.       $? macro
  21982.       $@ macro
  21983.       $< macro
  21984.       in C programs
  21985.       NMAKE
  21986.            $**
  21987.            $?
  21988.            $@
  21989.            $>
  21990.            AS
  21991.            CC
  21992.            defining
  21993.            MAKE
  21994.            MAKEFLAGS
  21995.            precedence of definitions
  21996.            predefined
  21997.            special characters in
  21998.            substitution
  21999.            undefined
  22000.            using
  22001.  MAKEFILE
  22002.  MAKEFLAGS macro
  22003.  Map files
  22004.       extensions
  22005.       /MAP (/M) option, LINK
  22006.       creating
  22007.       extensions
  22008.       frame numbers, obtaining
  22009.       naming with LINK
  22010.  /MAP option, LINK
  22011.  /MAX option, EXEMOD
  22012.  Memory model, defined
  22013.  Memory
  22014.       allocation, and EXEMOD
  22015.       blocks
  22016.            copying
  22017.            filling
  22018.            moving
  22019.       operators
  22020.       release
  22021.  Menu bar
  22022.  Menus, CodeView
  22023.       Calls
  22024.            Stack Trace command
  22025.            using
  22026.       defined
  22027.       File
  22028.            DOS Shell
  22029.            Exit
  22030.            Load
  22031.            Quit
  22032.       Help
  22033.       keyboard, selection from
  22034.       mouse, selection from
  22035.       Options
  22036.            386 option
  22037.            Bytes Coded
  22038.            Case Sense
  22039.            Flip/Swap
  22040.       Run
  22041.            Clear Breakpoints
  22042.            Execute
  22043.            Restart
  22044.            Start
  22045.       Search
  22046.            Find
  22047.            Label
  22048.            Next
  22049.            Previous
  22050.       View
  22051.            Assembly
  22052.            Mixed
  22053.            Output
  22054.            Registers
  22055.            Source
  22056.       Watch
  22057.            Add Watch
  22058.            Delete All
  22059.            Delete Watch
  22060.            Tracepoint
  22061.            Watchpoint
  22062.  Message box
  22063.  /MIN option, EXEMOD
  22064.  Minimum allocation value, controlling
  22065.  Minus sign (-)
  22066.       FORTRAN
  22067.       LIB command symbol
  22068.  Minus sign-asterisk (-*), LIB command symbol
  22069.  Minus sign-plus sign (-+), LIB command symbol
  22070.  Mixed mode
  22071.  Mixed-language programming, CodeView
  22072.  Mnemonic keys, CodeView
  22073.  Module statements
  22074.       defined
  22075.       listed
  22076.       rules for
  22077.  Module-definition files
  22078.       described
  22079.       import libraries and
  22080.       OS/2 linker and
  22081.       rules for
  22082.       statements
  22083.            CODE
  22084.            DATA
  22085.            DESCRIPTION
  22086.            EXETYPE
  22087.            EXPORTS
  22088.            HEAPSIZE
  22089.            IMPORTS
  22090.            LIBRARY
  22091.            NAME
  22092.            OLD
  22093.            PROTMODE
  22094.            REALMODE
  22095.            SEGMENTS
  22096.            STACKSIZE
  22097.            STUB
  22098.  Modules
  22099.       defined
  22100.       examination
  22101.  Monochrome adapter (MA)
  22102.  Mouse
  22103.       driver
  22104.       ignore option
  22105.       pointer
  22106.       selecting with
  22107.  Move Memory command
  22108.  MSC
  22109.  
  22110.  N
  22111.  ───────────────────────────────────────────────────────────────────────────
  22112.  
  22113.  N (Radix command)
  22114.  /n option, BIND
  22115.  /N option, NMAKE
  22116.  NAME statement
  22117.  Naming files
  22118.  NAN (not a number)
  22119.  .NE. operator
  22120.  Negation operator, FORTRAN
  22121.  .NEQV. operator
  22122.  NMAKE
  22123.       command line
  22124.       commands, specifying
  22125.       dependency lines
  22126.       dependents, specifying
  22127.       description blocks
  22128.       description file, described
  22129.       double-colon (::) separator
  22130.       error handling
  22131.       error messages
  22132.       escape character
  22133.       exit codes
  22134.       inference rules
  22135.            described
  22136.            predefined
  22137.            using
  22138.       invoking
  22139.       macro substitution
  22140.       macros, listed
  22141.       pseudotargets
  22142.       response-file generation
  22143.       targets
  22144.       vs. previous versions
  22145.  NMAKE directives
  22146.       !CMDSWITCHES
  22147.       !ELSE
  22148.       !ENDIF
  22149.       !ERROR
  22150.       !IF
  22151.       !IFDEF
  22152.       !IFNDEF
  22153.       !INCLUDE
  22154.       !UNDEF
  22155.       described
  22156.       listed
  22157.  NMAKE options
  22158.  NMI trapping
  22159.  /NOD option, LINK
  22160.  /NODEFAULTLIBRARYSEARCH option, LINK
  22161.  /NOE option, LINK
  22162.  /NOEXTDICTIONARY option, LINK
  22163.  /NOF option, LINK
  22164.  /NOFARCALLTRANSLATION option, LINK
  22165.  /NOG option, LINK
  22166.  /NOGROUPASSOCIATION option, LINK
  22167.  /NOI option
  22168.       LIB
  22169.       LINK
  22170.  /NOIGNORECASE option
  22171.       LIB
  22172.       LINK
  22173.  /NON option, LINK
  22174.  Nonequivalence operator, FORTRAN
  22175.  Nonfatal error messages, LINK
  22176.  /NONULLDOSSEG option, LINK
  22177.  /NOP option, LINK
  22178.  /NOPACKCODE option, LINK
  22179.  Not-equal-to operator, FORTRAN
  22180.  .NOT. operator
  22181.  NUL
  22182.  Number sign (#)
  22183.       NMAKE comment character
  22184.       Tab Set command
  22185.  Numbers, floating point
  22186.  
  22187.  O
  22188.  ───────────────────────────────────────────────────────────────────────────
  22189.  
  22190.  O (Option Command)
  22191.  /o option, BIND
  22192.  /O option, LINK
  22193.  Object files
  22194.       extensions
  22195.       naming, default
  22196.       NMAKE inference rules, used in
  22197.       object modules, difference from
  22198.       specifying
  22199.            LINK command line
  22200.            LINK prompts
  22201.            LINK response file
  22202.  Object modules
  22203.       defined
  22204.       libraries
  22205.            deleting from
  22206.            extracting and deleting from
  22207.            including in
  22208.       listing (LIB)
  22209.       object files, difference from
  22210.  Object ranges, arguments, used as
  22211.  Octal notation
  22212.       BASIC
  22213.       C
  22214.       FORTRAN
  22215.  /Od compiler option
  22216.  OLD statement
  22217.  Operands, machine instruction, displayed by CodeView
  22218.  Operators
  22219.       BASIC
  22220.       C
  22221.       FORTRAN
  22222.       memory, CodeView
  22223.  Optimization, and CodeView
  22224.  Option command
  22225.  .OR. operator
  22226.  Ordinal position
  22227.  Output screen, CodeView
  22228.  Output
  22229.       Port command
  22230.       View menu selection
  22231.  /OVERLAYINTERRUPT option, LINK
  22232.  Overlays
  22233.       interrupt number, setting
  22234.       LINK, specifying
  22235.       overlay manager prompts
  22236.       search path
  22237.  
  22238.  P
  22239.  ───────────────────────────────────────────────────────────────────────────
  22240.  
  22241.  /P option
  22242.       CodeView
  22243.       NMAKE
  22244.  P (Program Step command)
  22245.  Packed files, and CodeView
  22246.  Packing executable files, LINK
  22247.  /PADC option, LINK
  22248.  /PADCODE option, LINK
  22249.  /PADD option, LINK
  22250.  /PADDATA option, LINK
  22251.  Page size, library
  22252.  /PAGESIZE option, LIB
  22253.  Palette registers, and CodeView
  22254.  Paragraph space
  22255.  Parameters, program
  22256.  Parentheses (), FORTRAN
  22257.  Pascal, compiling and linking
  22258.  Pass count
  22259.  PATH command, CodeView
  22260.  /PAU option, LINK
  22261.  Pause command
  22262.  /PAUSE option, LINK
  22263.  Period (.)
  22264.       Current Location command
  22265.       operator
  22266.            C
  22267.            FORTRAN
  22268.       regular expressions, used in
  22269.  PGDN key (scroll page down)
  22270.  PGUP key (scroll page up)
  22271.  Physical segment, defined
  22272.  Plus sign (+)
  22273.       LIB command symbol
  22274.            Intel, XENIX files, used with
  22275.            libraries, combining and specifying
  22276.            object files, appending
  22277.            using
  22278.       LINK command symbol
  22279.  Point, defined
  22280.  Pointer, mouse
  22281.  Port Output command
  22282.  Precedence of operators
  22283.       BASIC
  22284.       C
  22285.       FORTRAN
  22286.  .PRECIOUS pseudotarget
  22287.  Prefixes, with format specifiers
  22288.  printf type specifiers
  22289.  PRIVATE combine type
  22290.  Procedure calls
  22291.       Stack Trace command
  22292.       stepping over
  22293.       tracing into
  22294.  Program arguments, CodeView
  22295.  Program header, inspection of
  22296.  Program Step command
  22297.       F10 function key
  22298.       mouse, executing with
  22299.       using
  22300.  Prompt, CodeView (>)
  22301.  Protected mode
  22302.  Protected-mode (80286) mnemonics
  22303.  Protected-mode format, executable files
  22304.  PROTMODE statement
  22305.  Pseudotargets
  22306.  PUBLIC combine type
  22307.  Public names. See Public symbols
  22308.  Public symbols
  22309.       LIB
  22310.       LINK
  22311.       Macro Assembler
  22312.  
  22313.  Q
  22314.  ───────────────────────────────────────────────────────────────────────────
  22315.  
  22316.  Q (Quit command), CodeView
  22317.  /Q option
  22318.       LINK
  22319.       NMAKE
  22320.  /QUICKLIB option, LINK
  22321.  Quotation marks (""), Pause command
  22322.  
  22323.  R
  22324.  ───────────────────────────────────────────────────────────────────────────
  22325.  
  22326.  R (Register command)
  22327.  /R option, NMAKE
  22328.  Radix
  22329.       command, using
  22330.       current
  22331.            BASIC
  22332.            C
  22333.            effect on display
  22334.            effect on unassemble
  22335.            FORTRAN
  22336.  Ranges, arguments, used as
  22337.  Real mode
  22338.  REALMODE statement
  22339.  Redirection
  22340.       commands
  22341.       start-up commands, used in
  22342.  Redraw command
  22343.  References
  22344.       long
  22345.       near segment-relative
  22346.       near self-relative
  22347.       resolving
  22348.       short
  22349.       unresolved
  22350.  Register
  22351.       argument, used as
  22352.       command
  22353.            changing register values
  22354.            displaying registers
  22355.            F2 function key
  22356.            mouse, executing with
  22357.            View menu selection
  22358.       DS, described
  22359.       variables
  22360.       window
  22361.  Regular expressions
  22362.       searches, used in
  22363.       searching for
  22364.       specifying
  22365.  Regular libraries, LINK command line
  22366.  Relational expressions
  22367.  Relational operators
  22368.       BASIC
  22369.  Relocation
  22370.       information
  22371.       table
  22372.  Response files
  22373.       LIB
  22374.       LINK
  22375.       NMAKE
  22376.  Restart command
  22377.       Run menu selection
  22378.       using
  22379.  restrictions, CodeView
  22380.  Return codes. See Exit codes
  22381.  ROM (read-only memory)
  22382.  Routines
  22383.       and CodeView
  22384.       arguments, value of
  22385.       calls to
  22386.  Run menu
  22387.       Clear Breakpoints
  22388.       Execute
  22389.       Restart
  22390.       Start
  22391.  Run-time libraries
  22392.  Running
  22393.       LIB
  22394.            command line
  22395.            prompts
  22396.            response file
  22397.       LINK
  22398.            command line
  22399.            prompts
  22400.  
  22401.  S
  22402.  ───────────────────────────────────────────────────────────────────────────
  22403.  
  22404.  S (Set Mode command)
  22405.  /S option
  22406.       CodeView
  22407.       NMAKE
  22408.  Screen
  22409.       buffer
  22410.       exchange
  22411.            command
  22412.            F4 function key
  22413.            method
  22414.       movement commands
  22415.       two, using
  22416.  Scroll bar, defined
  22417.  /SE option, LINK
  22418.  Search
  22419.       command
  22420.            menu selections
  22421.            regular expressions, used with
  22422.            using
  22423.       menu
  22424.            Find
  22425.            Label
  22426.            Next
  22427.            Previous
  22428.  Search paths
  22429.       dependents
  22430.       libraries
  22431.       overlays
  22432.  Segment attributes
  22433.       CODE statement
  22434.       DATA statement
  22435.       SEGMENT statement
  22436.  Segment, defined
  22437.  Segmented-executable file format
  22438.  /SEGMENTS option, LINK
  22439.  SEGMENTS statement
  22440.  Segments
  22441.       alignment types
  22442.       class names
  22443.       class types
  22444.       combine types
  22445.       combining
  22446.       number allowed
  22447.       order
  22448.  Semicolon (;)
  22449.       LIB command symbol
  22450.       LINK command symbol
  22451.  Separator line
  22452.  Sequential mode
  22453.       CodeView
  22454.       redirection, used with
  22455.       starting
  22456.  Set Block, DOS function call (#4A)
  22457.  Set Mode command
  22458.       dialog command
  22459.       F3 function key
  22460.       using
  22461.       View menu selection
  22462.  SETENV
  22463.       error messages
  22464.       exit codes
  22465.       utility
  22466.  Shell Escape command
  22467.       File menu selection
  22468.       using
  22469.  Short reals
  22470.       Codeview, entering with
  22471.       dumping
  22472.  .SILENT pseudotarget
  22473.  Source-module files, location
  22474.  Source
  22475.       file, line-number arguments, used with
  22476.       mode
  22477.  /ST option, LINK
  22478.  /STACK option, LINK
  22479.  /STACK option
  22480.       EXEMOD
  22481.       LINK
  22482.  Stack size
  22483.       controlling
  22484.       setting
  22485.  Stack Trace command
  22486.       display contents
  22487.       using
  22488.  STACK
  22489.       8087 register
  22490.       class name
  22491.       combine type
  22492.  STACKSIZE statement
  22493.  Standard places, libraries
  22494.  Start-up
  22495.       code
  22496.       file configuration, CodeView
  22497.  Startup routine
  22498.  Statements, module
  22499.       defined
  22500.       listed
  22501.       rules for
  22502.  Stopping
  22503.       library manager, LIB
  22504.       linker, LINK
  22505.  Strings
  22506.       arguments
  22507.            BASIC
  22508.            C
  22509.            FORTRAN
  22510.       concatenation, BASIC
  22511.       mnemonics
  22512.       operators, BASIC
  22513.  STUB statement
  22514.  Subprogram calls
  22515.       Stack Trace command
  22516.       stepping over
  22517.       tracing into
  22518.  .SUFFIXES pseudotarget
  22519.  Swapping
  22520.       disks, during linking
  22521.       screen
  22522.  Symbols
  22523.       BASIC
  22524.       C
  22525.       examining
  22526.       FORTRAN
  22527.       underscore (_), in names
  22528.  SYMDEB
  22529.  Syntax
  22530.       CodeView summary
  22531.       error
  22532.  SYSTEM-REQUEST key
  22533.  
  22534.  T
  22535.  ───────────────────────────────────────────────────────────────────────────
  22536.  
  22537.  T (Trace command)
  22538.  /T option
  22539.       CodeView
  22540.       NMAKE
  22541.  Tab Set command
  22542.  Targets
  22543.       defined
  22544.       macros for
  22545.       specifying
  22546.            description blocks
  22547.            multiple blocks
  22548.  Text strings, finding
  22549.  TMP environment variable, used by LINK
  22550.  TOOLS.INI file
  22551.       ignoring inference rules and macros in
  22552.       inference rules, used in
  22553.       precedence of macros
  22554.  Trace command
  22555.       dialog command
  22556.       F8 function key
  22557.  Tracepoint command
  22558.       sequential mode
  22559.       setting
  22560.       Watch menu selection
  22561.  Tracepoint, defined
  22562.  Two-color graphics display, CodeView
  22563.  Type specifiers
  22564.  
  22565.  U
  22566.  ───────────────────────────────────────────────────────────────────────────
  22567.  
  22568.  U (Unassemble command)
  22569.  !UNDEF directive, NMAKE
  22570.  Underscore (_), symbol names
  22571.  Unsigned integers, dumping
  22572.  UP ARROW key (cursor up)
  22573.  Utilities. See EXEMOD, LIB, LINK
  22574.  
  22575.  V
  22576.  ───────────────────────────────────────────────────────────────────────────
  22577.  
  22578.  V (View command)
  22579.  /v option
  22580.       EXEHDR
  22581.       ILINK
  22582.  Variables
  22583.       local
  22584.       special
  22585.            _edata
  22586.            _end
  22587.  Verbose mode
  22588.  Video-display pages
  22589.  View
  22590.       command
  22591.       menu
  22592.            Assembly
  22593.            Mixed
  22594.            Output
  22595.            Registers
  22596.            Source
  22597.  VM.TMP file
  22598.  
  22599.  W
  22600.  ───────────────────────────────────────────────────────────────────────────
  22601.  
  22602.  W commands
  22603.       Watch List
  22604.       Watch
  22605.  /W option
  22606.       CodeView
  22607.       LINK
  22608.  WAIT instruction
  22609.  /WARNFIXUP option, LINK
  22610.  Watch
  22611.       command
  22612.            menu selections
  22613.            sequential mode
  22614.            setting Watch statement
  22615.       expression statement
  22616.       memory statement
  22617.       menu
  22618.            Add Watch
  22619.            Delete All
  22620.            Delete Watch
  22621.            Tracepoint
  22622.            Watchpoint
  22623.       statements
  22624.            commands
  22625.            defined
  22626.            deletion
  22627.            listing
  22628.            summary
  22629.       window
  22630.  Watch Delete All command
  22631.  Watch Delete command
  22632.  Watch List command
  22633.  Watchpoint command
  22634.       sequential mode
  22635.       setting
  22636.       Watch menu selection
  22637.  Watchpoint, defined
  22638.  Wild-card characters
  22639.  Window commands
  22640.  Window mode
  22641.       CodeView
  22642.       starting
  22643.  WO operator
  22644.  Words (units of memory)
  22645.  WP (Watchpoint command)
  22646.  
  22647.  X
  22648.  ───────────────────────────────────────────────────────────────────────────
  22649.  
  22650.  X (Examine Symbols command)
  22651.  /X option, NMAKE
  22652.  
  22653.  Y
  22654.  ───────────────────────────────────────────────────────────────────────────
  22655.  
  22656.  Y (Watch Delete command)
  22657.  
  22658.  Z
  22659.  ───────────────────────────────────────────────────────────────────────────
  22660.  
  22661.  /Zd compiler option
  22662.  /Zi compiler option
  22663.  
  22664.