home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 181.img / TASM-101.ZIP / HELPME!.DOC < prev    next >
Text File  |  1989-05-02  |  11KB  |  254 lines

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