home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 6.ddi / DOC.ZIP / HELPME!.TSM < prev    next >
Encoding:
Text File  |  1992-06-10  |  10.3 KB  |  241 lines

  1. /*************************************************************************/
  2.                         TURBO ASSEMBLER 3.1
  3.                       MANUAL REFERENCE & CORRECTIONS
  4.  
  5. CONTENTS:
  6.     Turbo Assembler 3.1: Answers to Common Questions  
  7.  
  8.   The following are tips, tricks, and hints you may find useful
  9.   when using Turbo Assembler.
  10.  
  11.  Q. When should I use the different assembly modes TASM provides
  12.     for existing assembly programs?
  13.  A. Mode                   Conditions for Use
  14.     -------------------------------------------------------------
  15.     Normal(MASM)         - Program assembles under MASM 4.00 or
  16.                            MASM 5.00.
  17.     Quirks               - Program assembles under MASM 4.00 or
  18.                            MASM 5.00, but won't assemble under
  19.                            TASM without MASM51 or QUIRKS.
  20.     Masm51               - Program requires MASM 5.1 for assembly.
  21.     Masm51 and Quirks    - Program requires MASM 5.1 for
  22.                            assembly, but will not assemble
  23.                            under TASM with only the MASM51
  24.                            switch set.
  25.  
  26.  Q. Do I have to use MASM51 to assemble files written for MASM
  27.     5.1?
  28.  A. Most files will assemble even without using the MASM51
  29.     directive. However if your assembly code utilizes features
  30.     only found in MASM 5.1, you will need to use the MASM51 mode.
  31.     Check the table in the next Q&A to see which features of MASM51
  32.     emulation are enabled by combinations of MASM51 and QUIRKS
  33.     modes.
  34.  
  35.  Q. What items are controlled by the QUIRKS and MASM51 modes?
  36.  A. The following table lists what the various combinations of
  37.     QUIRKS and MASM51 modes do:
  38.  
  39.     Mode                   Operations
  40.     -------------------------------------------------------------
  41.     Quirks               - Allows FAR jumps to be generated as
  42.                            NEAR or SHORT if CS assumes agree.
  43.                          - Allows all instruction sizes to be
  44.                            determined in a binary operation solely
  45.                            by a register, if present.
  46.                          - Destroys OFFSET, segment override,
  47.                            etc., information on '=' or numeric 'EQU'
  48.                            assignments.
  49.                          - Forces EQU assignments to expressions
  50.                            that contain "PTR" or ":" to be text.
  51.  
  52.     Masm51               - Instr, Catstr, Substr, Sizestr, and
  53.                            "\" line continuation are all enabled.
  54.                          - EQU's to keywords are made TEXT
  55.                            instead of ALIASes.
  56.                          - Leading whitespace is not discarded
  57.                            on %textmacro in macro arguments.
  58.  
  59.     Masm51 and Quirks    - Everything listed under QUIRKS above.
  60.                          - Everything listed under MASM51 above.
  61.                          - @@, @F, and @B local labels are
  62.                            enabled.
  63.                          - Procedure names are PUBLIC'ed
  64.                            automatically in extended MODELs.
  65.                          - Near labels in PROCs are redefinable
  66.                            in other PROCs.
  67.                          - "::" operator is enabled to define
  68.                            symbols that can be reached outside of
  69.                            current proc.
  70.  
  71.     Masm51 and Ideal     - Ideal mode syntax and the Masm51 text
  72.                            macro directives are supported, i.e.,
  73.                            Instr, Catstr, Substr, and Sizestr.
  74.  
  75.   Q. When should I use the DOSSEG or .STACK directives?
  76.   A. When you're developing Turbo Assembler modules to link with
  77.      high-level languages like Turbo C++ and Turbo Pascal, you
  78.      don't need the DOSSEG or .STACK directives because these
  79.      compilers will handle segment-ordering and stack setup.
  80.      These directives define segment names and order that might
  81.      conflict with those used by the high-level language. You
  82.      only need, however, to define these once in any module of a
  83.      standalone assembler program. DOSSEG is only needed if you
  84.      want your segments to be ordered using Microsoft's
  85.      conventions. You can define your own segment-ordering by
  86.      ensuring that your segments are encountered by TLINK in the
  87.      order that you wish. See the TLINK section of the manual for
  88.      a full description of how this works.
  89.  
  90.   Q. What options should I use when I use Turbo Assembler to
  91.      assemble the files that came with the Microsoft C Compiler?
  92.   A. When assembling the assembly language modules provided with the
  93.      Microsoft compilers, make sure to use the MASM51 and QUIRKS
  94.      modes. For example,
  95.  
  96.        tasm /jmasm51 /jquirks filename
  97.  
  98.   Q. How do I create a .COM file?
  99.   A. Your assembler source should be assembled in the tiny model
  100.      (.MODEL TINY) and should include an ORG 100h following the
  101.      opening of the code segment, as shown below:
  102.  
  103.                 .MODEL  TINY
  104.                 .CODE
  105.                 ORG     100h
  106.         start:
  107.                 ....          ; body of program
  108.         END     start         ; defines the entry point as start
  109.  
  110.      Don't include a .STACK directive in a program designed to be
  111.      a .COM.
  112.  
  113.      TLINK will create a .COM file instead of an .EXE file if the /t
  114.      option is specified. For example,
  115.  
  116.         tlink /t SHOW87
  117.  
  118.      will create SHOW87.COM instead of SHOW87.EXE.
  119.  
  120.      There are certain limitations in converting an .EXE file to a
  121.      .COM file. These limitations are documented in the IBM Disk
  122.      Operating System manual under EXE2BIN.
  123.  
  124.   Q. How do I assemble multiple files with Turbo Assembler?
  125.   A. Turbo Assembler will assemble multiple files using wildcard
  126.      characters or separating them by the plus (+) character.
  127.      As an example, the following command line
  128.  
  129.        tasm filt + o*
  130.  
  131.      would assemble the file FILT.ASM, as well as all the .ASM
  132.      files beginning with the letter 'o'.
  133.  
  134.   Q. How can I assemble multiple files if they don't all use the
  135.      same command-line options?
  136.   A. Turbo Assembler uses the semicolon (;) character as a
  137.      command-line separator so that you can actually have
  138.      multiple assembler command lines on a single DOS command
  139.      line. As an example, the following command line
  140.  
  141.        tasm /zi filt; o*
  142.  
  143.      would assemble the file FILT.ASM with debug information
  144.      turned on, then assemble all the .ASM files beginning with
  145.      the letter 'o' without debug information.
  146.  
  147.   Q. Microsoft's Macro Assembler allows me to define environment
  148.      variables so I don't have to enter them on every command
  149.      line. Can I do this with Turbo Assembler as well?
  150.   A. No, but Turbo Assembler provides an even more flexible way
  151.      to eliminate typing in command-line options every time.
  152.      Whenever you run Turbo Assembler, it looks in the current
  153.      directory, then in the directory from which it was started
  154.      (DOS 3.x and greater) for a special file called TASM.CFG.
  155.      This file can contain anything that the command line
  156.      contains. This file is processed first and then the command
  157.      line so that the command-line options take priority over
  158.      those found in the TASM.CFG configuration file. If, for
  159.      instance, your command-line options are always
  160.  
  161.        /t /ml /zi /jJUMPS /jLOCALS
  162.  
  163.      you could create TASM.CFG file containing these lines
  164.  
  165.        /t
  166.        /ml
  167.        /zi
  168.        /jJUMPS
  169.        /jLOCALS
  170.  
  171.      Now, every time you run Turbo Assembler, those will be the
  172.      default options. This means that, if you need to, you can
  173.      have separate TASM.CFG files for each of your projects. If
  174.      you have multiple projects residing in a single subdirectory,
  175.      then you could create a separate configuration file for each
  176.      and use them as Turbo Assembler indirect command files.
  177.  
  178.   Q. What are Turbo Assembler indirect command files?
  179.   A. These are files that contain partial or complete Turbo
  180.      Assembler command lines and are preceded with an at-sign (@)
  181.      on the command line. For example, if you have a file named
  182.      "FILE.CMD" that contains the following,
  183.  
  184.        /t
  185.        /ml
  186.        /zi
  187.        /jJUMPS
  188.        /jLOCALS
  189.        file1 +
  190.        file2 +
  191.        file3 +
  192.        file4
  193.  
  194.      then you could use the command line
  195.  
  196.        tasm @FILE.CMD
  197.  
  198.      instead of the command line
  199.  
  200.        tasm /t /ml /zi /jJUMPS /jLOCALS file1+file2+file3+file4
  201.  
  202.      Note that the at-sign (@) is not actually part of the file's
  203.      name. In fact, if you name a file with an at-sign at the
  204.      beginning, Turbo Assembler will treat it as an indirect
  205.      command file.
  206.  
  207.   Q. I am linking my own assembly language functions with Turbo C.
  208.      Why does the linker report that all of my functions are
  209.      undefined?
  210.   A. Make sure you've put an underbar character (_) in front
  211.      of all assembly language function names to be called
  212.      by Turbo C. If you use simplified segmentation and include
  213.      the C language specifier on the .MODEL directive, Turbo
  214.      Assembler will pre-append the underbar automatically for you.
  215.      Your assembly language program should be assembled with Case
  216.      Sensitivity (/ML or /MX). 
  217.  
  218.   Q. Can I use the backslash (\) instead of the slash (/) as a
  219.      option specifier?
  220.   A. NO! Turbo Assembler (and MASM) will treat that as a file
  221.      that resides in the root directory of the default drive.
  222.      Since both assemblers treat the space character ( ) as a
  223.      comma (,) this could result in the loss of files. If you
  224.      accidentally gave this command line,
  225.  
  226.       tasm \zi prid&joy.asm
  227.  
  228.      Turbo Assembler (and MASM) would treat this command line as
  229.      instructions to assemble a file called ZI.ASM that can be
  230.      found in the root directory and create an output file in the
  231.      current directory called PRID&JOY.ASM. (Note that the
  232.      assemblers think the default extension for the object file
  233.      of .OBJ has been explicitly overridden to .ASM.) The file
  234.      PRID&JOY.ASM will either be overwritten with the object file
  235.      or deleted if the file \ZI.ASM can't be found and success-
  236.      fully assembled. In either case, the original contents of
  237.      PRID&JOY.ASM are now lost.
  238.  
  239. /**************************** END OF FILE ********************************/
  240.  
  241.