home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 240.img / TASM20-1.ZIP / MANUAL.ZIP / UTIL.DOC < prev   
Encoding:
Text File  |  1990-05-07  |  37.3 KB  |  1,111 lines

  1.  
  2. Turbo Assembler utilities
  3.  
  4.  
  5. Turbo Assembler provides six powerful stand-alone utilities. You
  6. can use these stand-alone utilities with your Turbo Assembler
  7. files, as well as with your other modules. MAKE, TLINK, and TLIB
  8. are documented in the Turbo Assembler Reference Guide; some
  9. additional information about TLINK is included at the beginning
  10. of this file. 
  11.  
  12. GREP (a file-search utility), OBJXREF (an object module
  13. cross-referencer), and TCREF (a cross-reference utility) are
  14. documented here.
  15.  
  16.  
  17.    TLINK: Turbo Link
  18.  
  19. When a detailed map is requested through use of the /s switch, the
  20. list of public symbols (if it appears) has public symbols flagged
  21. with "idle" if there are no references to that symbol. For example,
  22. this fragment from the public symbol section of a map file indicates
  23. that symbols Symbol1 and Symbol3 are not referenced by the image
  24. being linked:
  25.  
  26.   0C7F:031E    idle    Symbol1
  27.   0000:3EA2            Symbol2
  28.   0C7F:0320    idle    Symbol3
  29.  
  30.  
  31. /o switch (overlays)
  32.  
  33. The /o option causes the code in all modules or libraries specified
  34. after the option to be overlaid. It remains in effect until the next
  35. comma (explicit or implicit) or /o- in the command stream. /o- turns
  36. off overlaying.
  37.  
  38. The /o option can be optionally followed by a segment class name;
  39. this will cause all segments of that class to be overlayed. When no
  40. such name is specified, all segments of classes ending with CODE
  41. will be overlayed. Multiple /o options can be given, thus overlaying
  42. segments of several classes; all /o options remain in effect until
  43. the next comma or /o- is encountered.
  44.  
  45. The syntax /o#xx, where xx is a two-digit hexadecimal number,
  46. overrides the overlay interrupt number, which by default is 3FH.
  47.  
  48. Here are some examples of /o options:
  49.  
  50.   /o             Overlay all code segments until next comma or /o-.
  51.  
  52.   /o-            Stop overlaying.
  53.  
  54.   /oOVY          Overlay segments of class OVY until the next comma
  55.                  or /o-.
  56.  
  57.   /oCODE /oOVLY  Overlay segments of class CODE or class OVLY until next
  58.                  comma or /o-.
  59.  
  60.   /o#F0          Use interrupt vector 0F0H for overlays.
  61.  
  62. You can use the /o option in response files. If you use the /o option
  63. in a response file, it will be turned off automatically before the
  64. libraries are processed. If you want to overlay a library, you must use
  65. another /o right before all the libraries or right before the library you
  66. want to overlay.
  67.  
  68.  
  69. /y (expanded or extended memory)
  70.  
  71. This switch controls TLINK's use of expanded or extended memory
  72. for I/O buffering. If, while reading object files or while
  73. writing the executable file, TLINK needs more memory for active data
  74. structures, it will either purge buffers or swap them to expanded or
  75. extended meory.
  76.  
  77. In the case of input file buffering, purging simply means throwing away
  78. the input buffer so that its space can be used for other data structures.
  79. In the case of output file buffering, purging means writing the buffer to
  80. its correct place in the executable file. In either case, you can
  81. substantially increase the speed of a link by allowing these buffers
  82. to be swapped to expanded or extended memory.
  83.  
  84. TLINK's capacity is not increased by swapping; only its performance
  85. is improved. By default, swapping to expanded memory is enabled, while
  86. swapping to extended memory is disabled. If swapping is enabled and no
  87. appropriate memory exists in which to swap, then swapping does not occur.
  88.  
  89. This switch has several forms, shown below
  90.  
  91.   /ye   enable expanded memory swapping (default)
  92.   /ye   disable expanded memory swapping
  93.   /yx   enable extended memory swapping
  94.   /yx-  disable extended memory swapping (default)
  95.  
  96.  
  97.    GREP: A file-search utility
  98.  
  99. GREP is a powerful search utility that can search for text in
  100. several files at once.
  101.  
  102. The general command-line syntax for GREP follows:
  103.  
  104.   grep [options] searchstring filespec [filespec filespec ...
  105.   filespec]
  106.  
  107. For example, if you want to see in which source files you call the
  108. setupmodem function, you could use GREP to search the contents of
  109. all the .ASM files in your directory to look for the string
  110. setupmodem, like this:
  111.  
  112.   grep setupmodem *.asm
  113.  
  114.  
  115.     The GREP options
  116.  
  117. In the command line, options are one or more single characters
  118. preceded by a hyphen symbol (-). Each individual character is a
  119. switch that you can turn on or off: type the plus (+) after a
  120. character to turn the option on, or type a hyphen (-) after the
  121. character to turn the option off.
  122.  
  123. The default is on (the + is implied): for example, -r means the
  124. same thing as -r+. You can list multiple options individually (like
  125. this: -i -d -l), or you can combine them (like this: -ild or -il -
  126. d, and so forth); they're all the same to GREP.
  127.  
  128. Here is a list of the option characters used with GREP and their
  129. meanings:
  130.  
  131.   -c  Count only: Only a count of matching lines is printed. For
  132.       each file that contains at least one matching line, GREP
  133.       prints the file name and a count of the number of matching
  134.       lines. Matching lines are not printed.
  135.  
  136.   -d  Directories: For each filespec specified on the command
  137.       line, GREP searches for all files that match the file
  138.       specification, both in the directory specified and in all
  139.       subdirectories below the specified directory. If you give a
  140.       filespec without a path, GREP assumes the files are in the
  141.       current directory.
  142.  
  143.   -i  Ignore case: GREP ignores uppercase/lowercase differences
  144.       (case-folding). GREP treats all letters a-z as being
  145.       identical to the corresponding letters A-Z in all
  146.       situations.
  147.  
  148.   -l  List match files: Only the name of each file containing a
  149.       match is printed. After GREP finds a match, it prints the
  150.       file name and processing immediately moves on to the next
  151.       file.
  152.  
  153.   -n  Numbers: Each matching line that GREP prints is preceded by
  154.       its line number.
  155.  
  156.   -o  UNIX output format: Changes the output format of matching
  157.       lines to support more easily the UNIX style of command-line
  158.       piping. All lines of output are preceded by the name of the
  159.       file that contained the matching line.
  160.  
  161.   -r  Regular expression search: The text defined by searchstring
  162.       is treated as a regular expression instead of as a literal
  163.       string.
  164.  
  165.   -u  Update options: GREP will combine the options given on the
  166.       command line with its default options and write these to
  167.       the GREP.COM file as the new defaults. (In other words,
  168.       GREP is self-configuring.) This option allows you to tailor
  169.       the default option settings to your own taste.
  170.  
  171.   -v  Non-match: Only non-matching lines are printed. Only lines
  172.       that do not contain the search string are considered to be
  173.       non-matching lines.
  174.  
  175.   -w  Word search: Text found that matches the regular expression
  176.       will be considered a match only if the character
  177.       immediately preceding and following cannot be part of a
  178.       word. The default word character set includes A-Z, 9-0, and
  179.       the underscore (_). An alternate form of this option allows
  180.       you to specify the set of legal word characters. Its form
  181.       is -w[set], where set is any valid regular expression set
  182.       definition. If alphabetic characters are used to define the
  183.       set, the set will automatically be defined to contain both
  184.       the uppercase and lowercase values for each letter in the
  185.       set, regardless of how it is typed, even if the search is
  186.       case-sensitive. If the -w option is used in combination
  187.       with the -u option, the new set of legal characters is
  188.       saved as the default set.
  189.  
  190.   -z  Verbose: GREP prints the file name of every file searched.
  191.       Each matching line is preceded by its line number. A count
  192.       of matching lines in each file is given, even if the count
  193.       is zero.
  194.  
  195.  
  196.        Order of precedence
  197.  
  198. Remember that each of GREP's options is a switch: Its state
  199. reflects the way you last "flipped" it. At any given time,
  200. each option can only be on or off. Each occurrence of a given
  201. option on the command line overrides its previous definition.
  202. For example,
  203.  
  204.   grep -r -i- -d -i -r-  main( my*.asm
  205.  
  206. Given this command line, GREP will run with the -d option on,
  207. the -i option on, and the -r option off.
  208.  
  209. You can install your preferred default setting for each option
  210. in GREP.COM with the -u option. For example, if you want GREP
  211. to always do a verbose search (-z on), you can install it with
  212. the following command:
  213.  
  214.   grep -u -z
  215.  
  216.  
  217.      The search string
  218.  
  219. The value of searchstring defines the pattern GREP will search
  220. for. A search string can be either a regular expression or a
  221. literal string. In a regular expression, certain characters
  222. have special meanings: They are operators that govern the
  223. search. In a literal string, there are no operators; each
  224. character is treated literally.
  225.  
  226. You can enclose the search string in quotation marks to
  227. prevent spaces and tabs from being treated as delimiters.
  228. Matches will not cross line boundaries (a match must be
  229. contained in a single line).
  230.  
  231. An expression is either a single character or a set of
  232. characters enclosed in brackets. A concatenation of regular
  233. expressions is a regular expression.
  234.  
  235.  
  236.        Operators in regular expressions
  237.  
  238. When you use the -r option, the search string is treated as a
  239. regular expression (not a literal expression) and the
  240. following characters take on special meanings:
  241.  
  242.   ^  A circumflex at the start of the expression matches the
  243.      start of a line.
  244.  
  245.   $  A dollar sign at the end of the expression matches the end
  246.      of a line.
  247.  
  248.   .  A period matches any character.
  249.  
  250.   *  An expression followed by an asterisk wildcard matches zero
  251.      or more occurrences of that expression. For example, in
  252.      fo*, the * operates on the expression o; it matches f, fo,
  253.      foo, and so on. (f followed by zero or more os), but
  254.      doesn't match fa.
  255.  
  256.   +  An expression followed by a plus sign matches one or more
  257.      occurrences of that expression: fo+ matches fo, foo, and so
  258.      on, but not f.
  259.  
  260.   [] A string enclosed in brackets matches any character in that
  261.      string, but no others. If the first character in the string
  262.      is a circumflex (^), the expression matches any character
  263.      except the characters in the string. For example, [xyz]
  264.      matches x, y, or z, while [^xyz} matches a and b, but not
  265.      x, y, or z. You can specify a range of characters with two
  266.      characters separated by a hyphen (-). These can be combined
  267.      to form expressions (like [a-bd-z?] to match ? and any
  268.      lowercase letter except c).
  269.  
  270.   \  The backslash escape character tells GREP to seach for the
  271.      literal character that follows it. For example, \. matches
  272.      a period instead of "any character."
  273.  
  274. Note: Four of the previously described characters ($, ., *,
  275. and +) do not have any special meaning when used within a
  276. bracketed set. In addition, the character ^ is only treated
  277. specially if it immediately follows the beginning of the set
  278. definition (that is, immediately after the [).
  279.  
  280. Any ordinary character not mentioned in the preceding list
  281. matches that character. (> matches >, # matches #, and so on.)
  282.  
  283.  
  284.      The file specification
  285.  
  286. The third item in the GREP command line is filespec, the file
  287. specification; it tells GREP which files (or groups of files)
  288. to search. filespec can be an explicit file name, or a generic
  289. file name incorporating the DOS ? and * wildcards. In
  290. addition, you can enter a path (drive and directory infor-
  291. mation) as part of filespec. If you give filespec without a
  292. path, GREP only searches the current directory.
  293.  
  294.  
  295.      Examples with notes
  296.  
  297. The following examples assume that all of GREP's options
  298. default to off:
  299.  
  300.  
  301.           Example 1
  302.  
  303. Command line:    grep start: *.asm
  304.  
  305. Matches:         start:
  306.                  restart:
  307.  
  308. Does not match:  restarted:
  309.                  ClockStart:
  310.  
  311. Files Searched:  *.ASM in current directory.
  312.  
  313. Note: By default, the search is case-sensitive.
  314.  
  315.  
  316.           Example 2
  317.  
  318. Command line:    grep -r [^a-z]main\ *( *.asm
  319.  
  320. Matches:         main(i:integer)
  321.                  main(i,j:integer)
  322.                  if (main  ()) halt;
  323.  
  324. Does not match:  mymain()
  325.                  MAIN(i:integer);
  326.  
  327. Files Searched:  *.ASM in current directory.
  328.  
  329. Note: GREP searches for the word main with no preceding lowercase
  330. letters ([^a-z]), followed by zero or more occurrences of blank
  331. spaces (\ *), then a left parenthesis.
  332.  
  333. Since spaces and tabs are normally considered to be command-line
  334. delimiters, you must quote them if you want to include them as part
  335. of a regular expression. In this case, the space after main is quoted
  336. with the backslash escape character. You could also accomplish this
  337. by placing the space in double quotes
  338.  
  339.    [^a-z]main" "*
  340.  
  341.  
  342.           Example 3
  343.  
  344. Command line:    grep -ri [a-c]:\\data\.fil *.asm *.inc
  345.  
  346. Matches:         A:\data.fil
  347.                  c:\Data.Fil
  348.                  B:\DATA.FIL
  349.  
  350. Does not match:  d:\data.fil
  351.                  a:data.fil
  352.  
  353. Files Searched:  *.ASM and *.INC in current directory.
  354.  
  355. Note:Because the backslash and period characters (\ and .) usually
  356. have special meaning, if you want to search for them, you must quote
  357. them by placing the backslash escape character immediately in front
  358. of them.
  359.  
  360.  
  361.           Example 4
  362.  
  363. Command line:    grep -ri [^a-z]word[^a-z] *.doc
  364.  
  365. Matches:         every new word must be on a new line.
  366.                  MY WORD!
  367.                  word--smallest unit of speech.
  368.                  In the beginning there was the WORD, and the WORD
  369.  
  370. Does not match:  Each file has at least 2000 words.
  371.                  He misspells toward as toword.
  372.  
  373. Files Searched:  *.DOC in the current directory.
  374.  
  375. Note: This format basically defines how to search for a given word.
  376.  
  377.  
  378.           Example 5
  379.  
  380. Command line:    grep -iw word *.doc
  381.  
  382. Matches:         every new word must be on a new line However,
  383.                  MY WORD!
  384.                  word: smallest unit of speech that conveys meaning.
  385.                  In the beginning there was the WORD, and the WORD
  386.  
  387. Does not match:  each document contains at least 2000 words!
  388.                  He seems to continually misspell "toward" as "toword."
  389.  
  390. Files searched:  *.doc in the current directory.
  391.  
  392. Note: This format defines a basic "word" search.
  393.  
  394.  
  395.           Example 6
  396.  
  397. Command line:    grep "search string with spaces" *.doc *.asm
  398.                  a:\work\myfile.*
  399.  
  400. Matches:         This is a search string with spaces in it.
  401.  
  402. Does not match:  THIS IS A SEARCH STRING WITH SPACES IN IT.
  403.                  This is a search string with many spaces in it.
  404.  
  405. Files Searched:  *.DOC and *.ASM in the current directory, and MYFILE.*
  406.                    in a directory called \WORK on drive A:.
  407.  
  408. Note: This is an example of how to search for a string with embedded spaces.
  409.  
  410.  
  411.           Example 7
  412.  
  413. Command line:    grep -rd "[ ,.:?'\"]"$ \*.doc
  414.  
  415. Matches:         He said hi to me.
  416.                  Where are you going?
  417.                  Happening in anticipation of a unique situation,
  418.                  Examples include the following:
  419.                  "Many men smoke, but fu man chu."
  420.  
  421. Does not match:  He said "Hi" to me
  422.                  Where are you going? I'm headed to the beach this
  423.  
  424. Files Searched:  *.DOC in the root directory and all its subdirectories
  425.                    on the current drive.
  426.  
  427. Note: This example searches for the characters ,.:?' and " at the
  428. end of a line. Notice that the double quote within the range is
  429. preceded by an escape character so it is treated as a normal character
  430. instead of as the ending quote for the string. Also, notice how the
  431. $ character appears outside of the quoted string. This demonstrates how
  432. regular expressions can be concatenated to form a longer expression.
  433.  
  434.  
  435.           Example 8
  436.  
  437. Command line:    grep -ild " the " \*.doc
  438.                  or grep -i -l -d " the " \*.doc
  439.                  or grep -il -d " the " \*.doc
  440.  
  441. Matches:         Anyway, this is the time we have
  442.                  do you think? The main reason we are
  443.  
  444. Does not match:  He said "Hi" to me just when I
  445.                  Where are you going? I'll bet you're headed to
  446.  
  447. Files Searched:  *.DOC in the root directory and all its subdirectories
  448.                    on the current drive.
  449.  
  450. Note: This example ignores case and just prints the names of any
  451. files that contain at least one match. The three examples show
  452. different ways of specifying multiple options.
  453.  
  454.  
  455.  
  456.    OBJXREF: The object module cross-reference utility
  457.  
  458. OBJXREF is a utility that examines a list of object files and library
  459. files and produces reports on their contents. One type of report lists
  460. definitions of public names and references to them. The other type
  461. lists the segment sizes defined by object modules.
  462.  
  463. There are two categories of public names: global variables and function
  464. names. The TEST1.ASM and TEST2.ASM files in the section "Sample OBJXREF
  465. Reports" on page 48 illustrate definitions of public names and
  466. external references to them. 
  467.  
  468. Object modules are object (.OBJ) files produced by TC, TCC, or TASM.
  469. A library (.LIB) file contains multiple object modules. An object
  470. module generated by TASM is given the same name as the .ASM source
  471. file it was compiled from, unless a different output file name is
  472. specifically indicated on the command line.
  473.  
  474.  
  475.      The OBJXREF command line
  476.  
  477. The OBJXREF command line consists of the word OBJXREF, followed by a
  478. series of command-line options and a list of object and library file
  479. names, separated by a space or tab character. The syntax is as follows:
  480.  
  481.   OBJXREF < options >  filename < filename ... >
  482.  
  483. The command-line options determine the kind of reports OBJXREF will
  484. generate and the amount of detail that OBJXREF will provide. They are
  485. discussed in more detail in the next section "Command-Line Options."
  486.  
  487. Each option begins with a forward slash (/) followed by a one- or
  488. two-character option name.
  489.  
  490. Object files and library files may be specified either on the command
  491. line or in a response file. On the command line, file names are
  492. separated by a space or a tab. All object modules specified as .OBJ
  493. files are included in reports. Like TLINK, however, OBJXREF includes
  494. only those modules from .LIB files which contain a public name
  495. referenced by an .OBJ file or by a previously included module from a
  496. .LIB file.
  497.  
  498. As a general rule, you should list all the .OBJ and .LIB files that are
  499. needed if the program is to link correctly, including the libraries.
  500.  
  501. File names may include a drive and directory path. The DOS ? and *
  502. wildcard characters may be used to identify more than one file. File
  503. names may refer to .OBJ object files or to .LIB library files. (If no
  504. file extension is given, the .OBJ extension is assumed.)
  505.  
  506. Options and file names may occur in any order in the command line.
  507.  
  508. OBJXREF reports are written to the DOS standard output. The default is
  509. the screen. The reports may be sent to a printer (as with >LPT1:) or to
  510. a file (as with >lstfile) with the DOS redirection character (>).
  511.  
  512. Entering OBJXREF with no file names or options produces a summary of
  513. available options.
  514.  
  515.  
  516.        Command-line options
  517.  
  518. OBJXREF command-line options fall into two categories: control options
  519. and report options.
  520.  
  521.  
  522.           Control options
  523.  
  524. Control options modify the default behavior of OBJXREF (the default is
  525. that none of these options are enabled).
  526.  
  527.   /I  Ignore case differences in public names: Use this option if
  528.       you use TLINK without the /c option (which makes case differences
  529.       significant).
  530.  
  531.   /F  Include Full library: All object modules in specified .LIB files
  532.       are included even if no public names they contain are referenced
  533.       by an object module being processed by OBJXREF. This provides
  534.       information on the entire contents of a library file. (See
  535.       example 4 in the section "OBJXREF Examples.")
  536.  
  537.   /V  Verbose output: Lists names of files read and displays totals of
  538.       public names, modules, segments, and classes.
  539.  
  540.   /Z  Include Zero Length Segment Definitions: Object modules may
  541.       define a segment without allocating any space in it. Listing
  542.       these zero length segment definitions normally makes the
  543.       module size reports harder to use but it can be valuable if
  544.       you are trying to remove all definitions of a segment.
  545.  
  546.  
  547.           Report options
  548.  
  549. Report options govern what sort of report is generated, and the amount
  550. of detail OBJXREF provides.
  551.  
  552.   /RC  Report by Class Type: Module sizes ordered by class type of
  553.        segment.
  554.  
  555.   /RM  Report by Module: Public names ordered by defining module.
  556.  
  557.   /RP  Report by Public Names: Public names in order with defining
  558.        module name.
  559.  
  560.   /RR  Report by Reference: Public name definitions and references
  561.        ordered by name. (This is the default if no report option is
  562.        specified.)
  563.  
  564.   /RS  Report of Module Sizes: Module sizes ordered by segment name.
  565.  
  566.   /RU  Report of Unreferenced Symbol Names: Unreferenced public
  567.        names ordered by defining module.
  568.  
  569.   /RV  Verbose Reporting: OBJXREF produces a report of every
  570.        type.
  571.  
  572.   /RX  Report by External Reference: External references ordered by
  573.        referencing module name.
  574.  
  575.  
  576.        Response files
  577.  
  578. The command line is limited by DOS to a maximum of 128 characters. If
  579. your list of options and file names will exceed this limit, you must
  580. place your file names in a response file.
  581.  
  582. A response file is a text file that you make with an text editor. Since
  583. you may already have prepared a list of the files that make up your
  584. program for other Turbo Assembler programs, OBJXREF recognizes several
  585. response file types.
  586.  
  587. Response files are called from the command line using one of the
  588. following options. The response file name must follow the option without
  589. an intervening space (/Lresp not /L resp).
  590.  
  591. More than one response file can be specified on the command line, and
  592. additional .OBJ and .LIB file names may precede or follow them.
  593.  
  594.  
  595.           Freeform response files
  596.  
  597. You can create a freeform response file with a text editor. Just list
  598. the names of all .OBJ and .LIB files needed to make your .EXE file.
  599.  
  600. To use freeform files with OBJXREF, type in each file name on the
  601. command line, preceded by a at-sign (@), and separate it from other
  602. command-line entries with a space or tab:
  603.  
  604.   @filename  @filename ...
  605.  
  606. Note: Any file name that is listed in the response file without an
  607. extension is assumed to be a .OBJ file.
  608.  
  609.           Linker response files
  610.  
  611. Files in TLINK response file format can also be used by OBJXREF. A
  612. linker response file called from the command line is preceded by /L:
  613.  
  614.   /Lfilename
  615.  
  616. To see how to use one of these files, refer to Example 2 in the
  617. section, "Examples using OBJXREF."
  618.  
  619.  
  620.          The /D command
  621.  
  622. If you want OBJXREF to look for .OBJ files in a directory other than the
  623. current one, include the directory name on the command line, prefixed
  624. with /D:
  625.  
  626.   C:>OBJXREF/Ddir1[;dir2[;dir3]]
  627.  
  628. or
  629.  
  630.   C:>OBJXREF/Ddir1[/Ddir2][/Ddir3]
  631.  
  632. OBJXREF will search each of the directories in the specified order
  633. for all object and library files. If you don't use the /D option, only
  634. the current directory will be searched. However, if you use a /D
  635. option, the current directory will not be searched unless it is
  636. included in the directory list. For example, to first search the BORLAND
  637. directory for files and then search the current directory, you would
  638. type
  639.  
  640.   C:>OBJXREF/Dborland;
  641.  
  642. If multiple search directories are specified, and a file matching the
  643. file specification is found, OBJXREF will include the file as part of the
  644. cross-reference. OBJXREF will only continue to search the other
  645. directories for the same file specification if the file
  646. specification contains wildcards.
  647.  
  648.  
  649.           The /O command
  650.  
  651. The /O option allows you to specify an output file where OBJXREF will
  652. send any reports generated. It has the following syntax:
  653.  
  654.   C:>OBJXREF myfile.obj /RU
  655.   /Ofilename.ext
  656.  
  657. By default, all output is sent to the console.
  658.  
  659.  
  660.           The /N command
  661.  
  662. You can limit the modules, segments, classes, or public names that
  663. OBJXREF reports on by entering the appropriate name on the command
  664. line, prefixed with the /N command. For example,
  665.  
  666.   OBJXREF <filelist> /RM /NTest
  667.  
  668. tells OBJXREF to generate a report listing information only for the
  669. module named Test.
  670.  
  671.  
  672.      Sample OBJXREF reports
  673.  
  674. Suppose you have two source files in your Turbo Assembler directory, and
  675. wish to generate OBJXREF reports on the object files compiled from them.
  676. The source files are called TEST1.ASM and TEST2.ASM, and they look like
  677. this:
  678.  
  679.   ; TEST1.ASM
  680.  
  681.           .MODEL  small
  682.           STACK   200h
  683.           EXTRN   GOODBYE:BYTE           ;refers to Goodbye
  684.           EXTRN   SAYHELLO:NEAR          ;refers to SayHello
  685.  
  686.           PUBLIC  HELLO                  ;makes Hello public
  687.           PUBLIC  NOTUSED                ;makes NotUsed public
  688.  
  689.   .DATA
  690.   HELLO   DB      'Hello',10, 13, '$'    ;defines Hello
  691.   NOTUSED DW      ?
  692.   HIDDEN  DW      ?
  693.  
  694.   .CODE
  695.   SAYBYE  PROC    NEAR                   ;defines SayBye
  696.           mov     dx,OFFSET GOODBYE
  697.           mov     ah,9
  698.           int     21h
  699.           ret
  700.   SAYBYE  ENDP
  701.  
  702.   START   PROC    NEAR                   ;defines Start
  703.           mov     ax,@data
  704.           mov     ds,ax
  705.           call    SAYHELLO               ;refers to SayHello
  706.           call    SAYBYE                 ;refers to SayBye
  707.   EXIT:
  708.           mov     ax,04C00h
  709.           int     21h
  710.   START   ENDP
  711.   END     START
  712.  
  713.  
  714.   ; TEST2.ASM
  715.  
  716.           .MODEL  small
  717.  
  718.           EXTRN   HELLO:BYTE             ;refers to Hello
  719.  
  720.           PUBLIC  GOODBYE                ;makes Goodbye public
  721.           PUBLIC  SAYHELLO               ;makes SayHello public 
  722.   .DATA
  723.   GOODBYE DB      'Goodbye',10, 13, '$'  ;defines Goodbye
  724.  
  725.   .CODE
  726.   SAYHELLO        PROC    NEAR           ;defines SayHello
  727.           mov     dx,OFFSET HELLO        ;refers to Hello
  728.           mov     ah,9
  729.           int     21h
  730.           ret
  731.   SAYHELLO        ENDP
  732.   END
  733.  
  734. The object modules compiled from them are TEST1.OBJ and TEST2.OBJ.
  735. You can tell OBJXREF what kind of report to generate about these .OBJ
  736. files by entering the file names on the command line, followed by a /R
  737. and a second letter denoting report type.
  738.  
  739. Note: The examples that follow show only fragments of the output.
  740.  
  741.  
  742.        Report by public names (/RP)
  743.  
  744. A report by public names lists each of the public names defined in the
  745. object modules being reported on, followed by the name of the module
  746. in which it is defined.
  747.  
  748. If you enter the following on the command line,
  749.  
  750.   OBJXREF  /RP  test1  test2
  751.  
  752. OBJXREF will generate a report that looks like this:
  753.  
  754.    Symbol    Defined in
  755.  
  756.    GOODBYE   TEST2
  757.    HELLO     TEST1
  758.    NOTUSED   TEST1
  759.    SAYHELLO  TEST2
  760.  
  761.  
  762.        Report by module (/RM)
  763.  
  764. A report by module lists each object module being reported on, followed
  765. by a list of the public names defined in it.
  766.  
  767. If you enter the following on the command line,
  768.  
  769.   OBJXREF  /RM  test1  test2
  770.  
  771. OBJXREF will generate a report that looks like this:
  772.  
  773.   Module: TEST1 defines the following symbols:
  774.  
  775.      HELLO
  776.      NOTUSED
  777.  
  778.   Module: TEST2 defines the following symbols:
  779.  
  780.      GOODBYE
  781.      SAYHELLO
  782.  
  783.  
  784.        Report by reference (/RR) (default)
  785.  
  786. A report by reference lists each public name with the defining module
  787. in parentheses on the same line. Modules that refer to this public
  788. name are listed on following lines indented from the left margin.
  789.  
  790. If you enter the following on the command line,
  791.  
  792.   OBJXREF  /RR  test1  test2
  793.  
  794. OBJXREF will generate a report that looks like this:
  795.  
  796.   GOODBYE (TEST2)
  797.           TEST1
  798.   HELLO (TEST1)
  799.           TEST2
  800.   NOTUSED (TEST1)
  801.   SAYHELLO (TEST2)
  802.           TEST1
  803.  
  804.  
  805.        Report by external references (/RX)
  806.  
  807. A report by external references lists each module followed by a list
  808. of external references it contains.
  809.  
  810. If you enter the following on the command line,
  811.  
  812.   OBJXREF  /RX  test1  test2  CS.LIB
  813.  
  814. OBJXREF will generate a report that looks like this:
  815.  
  816.   Module: TEST1 references the following symbols:
  817.  
  818.     GOODBYE
  819.     SAYHELLO
  820.  
  821.   Module: TEST2 references the following:
  822.  
  823.     HELLO
  824.  
  825.  
  826.        Report of module sizes (/RS)
  827.  
  828. A report by sizes lists segment names followed by a list of modules
  829. that define the segment. Sizes in bytes are given in decimal and
  830. hexadecimal notation. The word uninitialized appears where no
  831. initial values are assigned to any of the symbols defined in the
  832. segment. Segments defined at absolute addresses in a .ASM file
  833. are flagged Abs to the left of the segment size.
  834.  
  835. If you enter the following on the command line,
  836.  
  837.   OBJXREF  /RS  test1  test2
  838.  
  839. OBJXREF will generate a report that looks like this:
  840.  
  841.   ;Module sizes by segment
  842.   STACK
  843.              512 (00200h)    TEST1, uninitialized
  844.              512 (00200h)    total
  845.   _DATA
  846.               12 (0000Ch)    TEST1
  847.               10 (0000Ah)    TEST2
  848.               22 (00016h)    total
  849.   _TEXT
  850.               24 (00018h)    TEST1
  851.                8 (00008h)    TEST2
  852.               32 (00020h)    total
  853.  
  854.  
  855.        Report by class type (/RC)
  856.  
  857. A report by class type lists segment size definitions by segment class.
  858. The CODE class contains instructions, DATA class contains initialized
  859. data and BSS class contains unitialized data. Segments that don't have
  860. a class type will be listed under the notation "No class type."
  861.  
  862. If you enter the following on the command line,
  863.  
  864.   OBJXREF  /RC  test1  test2
  865.  
  866. OBJXREF will generate a report that looks like this:
  867.  
  868.   ;Module sizes by class
  869.   CODE
  870.               24 (00018h)    TEST1
  871.                8 (00008h)    TEST2
  872.               32 (00020h)    total
  873.   DATA
  874.               12 (0000Ch)    TEST1
  875.               10 (0000Ah)    TEST2
  876.               22 (00016h)    total
  877.   STACK
  878.              512 (00200h)    TEST1, uninitialized
  879.              512 (00200h)    total
  880.  
  881.  
  882.        Report of unreferenced symbol names (/RU)
  883.  
  884. A report of unreferenced symbol names lists modules that define
  885. public names not referenced in other modules. Such a symbol is either
  886.  
  887. Referenced only from within the defining module and doesn't need to
  888. be defined as a public symbol (in that case, if the module is in C,
  889. the keyword static should be added to the definition; if the module is
  890. in TASM, just remove the public definition).
  891.  
  892. Never used (therefore, it can be deleted to save code or data space).
  893.  
  894. If you enter the following on the command line,
  895.  
  896.   OBJXREF  /RU  test1  test2
  897.  
  898. OBJXREF will generate a report that looks like this:
  899.  
  900.   Module:
  901.  
  902.      TEST1 defines the following unreferenced symbols:
  903.  
  904.      NOTUSED
  905.  
  906.  
  907.        Verbose reporting (/RV)
  908.  
  909. If you enter /RV on the command line, one report of each type will
  910. be generated.
  911.  
  912.  
  913.      Examples using OBJXREF
  914.  
  915. These examples assume that the application files are in the current
  916. directory of the default drive and that library files are in the \LIB
  917. directory.
  918.  
  919.  
  920. Example 1   C>OBJXREF test1 test2 \lib\io.lib
  921.  
  922. In addition to the TEST1.OBJ and TEST2.OBJ files, the library file
  923. \ LIB\IO.LIB is specified. Since no report type is specified, the
  924. resulting report is the default report by reference, listing public
  925. names and the modules that reference them.
  926.  
  927.  
  928. Example 2   C>OBJXREF /RV /Ltest1.arf
  929.  
  930. The TLINK response file TEST1.ARF contains the same list of files as
  931. the command line in Example 1. The /RV option is specified so that a
  932. report of every type will be generated. TEST1.ARF contains
  933.  
  934.   test1 test2
  935.   test1.exe
  936.   test1.map
  937.   \lib\io
  938.  
  939.  
  940. Example 3   C>OBJXREF /F /RV \lib\IO.lib
  941.  
  942. This example reports on all the modules in the library file IO.LIB;
  943. OBJXREF can produce useful reports even when the files specified
  944. don't make a complete program. The /F causes all modules in IO.LIB
  945. file to be included in the report.
  946.  
  947.  
  948.      Error messages and warnings
  949.  
  950. OBJXREF generates two sorts of diagnostic messages: error
  951. messages and warnings.
  952.  
  953.  
  954.        Error messages
  955.  
  956. Out of memory
  957.    OBJXREF performs its cross-referencing in RAM memory and may run out
  958.    of memory even if TLINK is able to link the same list of files
  959.    successfully. When this happens, OBJXREF aborts. Remove memory-resident
  960.    programs to get more space or add more RAM.
  961.  
  962.        Warnings
  963.  
  964. WARNING: Unable to open input file rrrr
  965.    The input file rrrr could not be located or opened. OBJXREF proceeds
  966.    to the next file.
  967.  
  968. WARNING: Unknown option - oooo
  969.    The option name oooo is not recognized by OBJXREF. OBJXREF ignores
  970.    the option.
  971.  
  972. WARNING: Unresolved symbol nnnn in module mmmm
  973.    The public name nnnn referenced in module mmmm is not defined in any
  974.    of the .OBJ or .LIB files specified. OBJXREF flags the symbol in any
  975.    reports it generates as being referenced but not defined.
  976.  
  977. WARNING: Invalid file specification ffff
  978.    Some part of the file name ffff is invalid. OBJXREF proceeds to the
  979.    next file.
  980.  
  981. WARNING: No files matching ffff
  982.    The file named ffff listed on the command line or in a response file
  983.    could not be located or opened. OBJXREF skips to the next file.
  984.  
  985. WARNING: Symbol nnnn defined in mmmm1 duplicated in mmmm2
  986.    Public name nnnn is defined in modules mmmm1 and mmmm2. OBJXREF
  987.    ignores the second definition.
  988.  
  989.  
  990.    TCREF: The source module cross-reference utility
  991.  
  992. TCREF is designed to produce two reports: a cross-reference
  993. list of where all global symbols are used and defined,
  994. and a list of individual modules and the symbols used
  995. within them.
  996.  
  997. TCREF accepts as input a group of .XRF files produced by TASM.
  998. These files contain cross-reference information for
  999. individual modules. From these input files, a single .REF file
  1000. is produced that contains one or more reports in ASCII text.
  1001. The command format follows:
  1002.  
  1003.   TCREF <XRF files separated by '+' characters> ','
  1004.      <REF filename> <switches>
  1005.  
  1006. For example, the following would take the FOO1.XRF, FOO2.XRF, and
  1007. FOO3.XRF as input files and produce FOO.REF:
  1008.  
  1009.   TCREF foo1+foo2+foo3,foo
  1010.  
  1011.  
  1012.      Response files
  1013.  
  1014. TCREF also accepts ASCII files as command strings. Simply precede the
  1015. file name with an @ sign to include a file in the command string. For
  1016. example,
  1017.  
  1018.   TCREF @dofoo
  1019.  
  1020. where DOFOO contains
  1021.  
  1022.   foo1+foo2+foo3,foo
  1023.  
  1024. will do the same thing as the previous example.
  1025.  
  1026.  
  1027.      Compatibility with TLINK
  1028.  
  1029. TCREF accepts command strings that TLINK accepts. TCREF ignores any
  1030. irrelevant switches and fields, such as any libraries or MAP files, or
  1031. switches that pertain only to the linker function. Similarly, if an
  1032. .XRF file cannot be located, TCREF will simply ignore it.
  1033.  
  1034. Beware! When using a TLINK response file, don't explicitly specify
  1035. file extensions, since doing so will override TCREF's internal
  1036. defaults and possibly result in disaster. For example, if the
  1037. response file reads a
  1038.  
  1039.   foo1+foo2+foo3,foo.exe
  1040.  
  1041. you should not use this file without modification with TCREF
  1042. because the .REF file it creates will be named FOO.EXE,
  1043. presumably overwriting your program.
  1044.  
  1045.  
  1046.        Switches
  1047.  
  1048. TCREF accepts all the switches present in TLINK, but most of
  1049. them are discarded. TCREF only uses these switches:
  1050.  
  1051.    /c makes GLOBAL report case-sensitive.
  1052.  
  1053.    /r generates LOCAL reports for all the specified modules.
  1054.  
  1055.    /p# sets report page length to # lines.
  1056.  
  1057.    /w# sets report page width to # columns.
  1058.  
  1059.  
  1060.      Output
  1061.  
  1062. TCREF takes great care to make semantic sense of symbols.Cross-reference
  1063. information is useless when symbols with the same name but different
  1064. meanings are lumped together. TCREF therefore takes into account the
  1065. SCOPE of a symbol when producing its reports. Cross-reference information
  1066. is always listed for the source file and source line number.
  1067.  
  1068.  
  1069.      The global (or linker-scope) report
  1070.  
  1071. TCREF's global report lists cross-reference information for global
  1072. symbols as they appear to the linker. Use the /c switch if you want
  1073. to produce case-sensitive reports.
  1074.  
  1075. In this report, global symbols appear alphabetically in the left column.
  1076. References, organized by source file, are listed in the right column.
  1077. Wherever #'s appear indicates that definition occurs at that line.
  1078.  
  1079. Here's an example symbol printout:
  1080.  
  1081.   Global Symbols       Cref  #  = definition
  1082.   BAR                  TEST.ASM:  1  3  6  9  12  15  18 +
  1083.                                               21  23  29
  1084.                                         #  TEST2.ASM:  2  4  6  #8
  1085.  
  1086. What does this tell you? The leading # sign before the TEST2.ASM
  1087. indicates that BAR was defined somewhere in that module. For each
  1088. source file, the source line at which the reference occurred is listed.
  1089. This list can occupy more than one line, as in the case of the
  1090. lines for TEST.ASM. The + character indicates that wrap has occurred.
  1091. Finally, the # sign before the 8 indicates that a definition of BAR
  1092. occurred in TEST2.ASM on line 8.
  1093.  
  1094.  
  1095.      The local (or module-scope) report
  1096.  
  1097. If you specify /r on the command line, a local report will be made for
  1098. each module. It will contain all the symbols used in that module,
  1099. listed in alphabetical order. The /c switch will have no effect on
  1100. these reports, since the appropriate case-sensitivity has already been
  1101. determined at assembly time.
  1102.  
  1103. Like global reports, references are organized by source file in the
  1104. right column. A sample printout looks like this:
  1105.  
  1106.   Module TEST.ASM Symbols        Cref  # = definition
  1107.   UGH                            TEST.ASM:  1  3  6  9  12  15  18 +
  1108.                                                         21  23  29
  1109.                                                  #  UGH.INC:  #2
  1110.  
  1111.