home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l224 / 1.img / MANUAL.ZIP / HELPME!.DOC < prev    next >
Encoding:
Text File  |  1990-10-29  |  10.8 KB  |  237 lines

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