home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 240.img / TASM20-1.ZIP / MANUAL.ZIP / UPDATE.DOC < prev    next >
Encoding:
Text File  |  1990-05-07  |  19.7 KB  |  566 lines

  1.  
  2. Turbo Assembler 2.0 New Features
  3.  
  4. Borland's Turbo Assembler 2.0 is now a multi-pass assembler that
  5. has forward-reference resolution, assembly speeds of up to 48,000
  6. lines per minute, MASM compatibility, and an optional Ideal mode
  7. extended syntax.
  8.  
  9. In addition to all the features of version 1.0, Turbo Assembler 2.0
  10. offers you these:
  11.  
  12.   o PUBLICDLL statement
  13.   o Multiple pass capability - NOP removal
  14.   o CALL extensions
  15.   o PUSH, POP instruction extensions
  16.   o COMM extension
  17.   o Generalized line-continuation character
  18.   o Language-specific procedures, extrns, publics
  19.   o New MODEL identifiers - WINDOWS
  20.   o Virtual segments
  21.   o QASM Compatibility Additions
  22.   o 486 instruction support
  23.   o New TASM 2.0 error messages
  24.   o CODEPTR type
  25.   o RETCODE instruction
  26.   o SMART/NOSMART directives
  27.   o Overlay object code
  28.  
  29.  
  30.                        --PUBLICDLL statement--
  31.  
  32.   The PUBLICDLL directive lets you define program labels and
  33.   procedures to be dynamic link entry points as well as publicizing
  34.   them to your other modules, which allows you to build dynamic link
  35.   libraries in assembly code. For example,
  36.  
  37.            PUBLICDLL XYPROC       ;make procedure XYPROC
  38.     XYPROC PROC NEAR              ;accessible as dynamic
  39.                                   ;link entry point
  40.  
  41.   The syntax for PUBLICDLL follows:
  42.  
  43.     PUBLICDLL [language] symbol [,[language] symbol]...}
  44.  
  45.   symbol is published in the object file as a dynamic link
  46.   entry point so that it can be accessed by programs under OS/2.
  47.   This statement is used only to help build an OS/2 dynamic link
  48.   library. If you don't make a symbol public, it can only be
  49.   accessed from the current source file.
  50.  
  51.   In most cases, you declare only PROC labels to be PUBLICDLL.
  52.   Other program labels, data variable names, and numeric constants
  53.   defined with EQU can also be declared to be PUBLICDLL.
  54.  
  55.   The optional language specifier causes any language-specific
  56.   conventions to be applied to the symbol name. For instance,
  57.   using the C language specifier would cause the symbol name to
  58.   be preceded by an underscore character when published in the
  59.   object file. Valid language specifiers are C, PASCAL, BASIC,
  60.   FORTRAN, PROLOG, and NOLANGUAGE.
  61.  
  62.   COMM, EXTRN, GLOBAL, and PUBLIC are related instructions.
  63.  
  64.  
  65.               --Multiple pass capability: NOP removal--
  66.  
  67.   Turbo Assembler 2.0 can pass over your source code more than once
  68.   either for compatibility with some of MASM's pass-dependent
  69.   constructions or to remove NOP instructions that were added to
  70.   the code because of forward references. This feature is enabled
  71.   by the command-line switch /m#, where # is the maximum number of
  72.   passes allowed. Turbo Assembler automatically assesses the
  73.   need to perform extra passes up to the maximum that you specify.
  74.  
  75.   The command-line switch /m sets the maximum number of
  76.   assembly passes:
  77.  
  78.     /M[npasses]
  79.  
  80.   For maximum compatibility with MASM, two passes (/m2) should
  81.   be used. If you don't specify the number of passes, a default
  82.   of five is used.
  83.  
  84.   TASM 2.0's new multiple pass capability enhances compatibility
  85.   with MASM in the following areas:
  86.  
  87.     1) Any construction that generates a "Pass-dependent
  88.        construction" warning in TASM 1.0. These include
  89.        constructions containing the IF2 directive, and some
  90.        constructions with IFDEF or IFNDEF. If the /m option is
  91.        enabled, Turbo Assembler will assemble this module
  92.        correctly but will not optimize the code by removing
  93.        NOPs, no matter how many passes are allowed. The warning
  94.        "Module is pass dependent--compatibility pass was done"
  95.        is displayed if this occurs.
  96.  
  97.     2) Forward-referenced macros.
  98.  
  99.   The NOP-squishing capability also enhances the use of other
  100.   TASM features, namely the JUMPS mode of operation. For
  101.   example,
  102.  
  103.     jumps
  104.             jnz foobar
  105.     foobar:
  106.  
  107.   Under TASM 1.0, the JNZ generates 3 NOPs, because FOOBAR is
  108.   forward-referenced. With the /m switch enabled in TASM 2.0,
  109.   these NOPs are eliminated: The JUMPS mode can be enabled with
  110.   no wasteful NOPs being generated.
  111.  
  112.   Usually, two passes are sufficient to squish out all NOPs.
  113.   Occasionally, however, more passes may be required. If you
  114.   need better compilation speed, place the correct overrides
  115.   everywhere so that a single pass will produce optimal code.
  116.  
  117.  
  118.                          --CALL extensions--
  119.  
  120.   The CALL instruction has been extended in Turbo Assembler
  121.   to allow high-level language routines to be called in a
  122.   language-independent manner. Any CALL instruction can now
  123.   specify a language and an argument list for the routine
  124.   being called. Turbo Assembler automatically generates
  125.   the necessary stack setup and cleanup code required to
  126.   pass the arguments to a high-level routine written in the
  127.   specified language. The syntax is as follows:
  128.  
  129.     CALL <destination> <optional language>,
  130.          <first argument>,<second argument>,...
  131.  
  132.   For example,
  133.  
  134.     call far ptr abc pascal,      ax dx,word ptr wordval
  135.  
  136.   This example generates a far call to the Pascal-style routine
  137.   ABC, which takes two arguments: a DWORD and a WORD. The DWORD
  138.   argument is considered to be in AX and DX, and the WORD
  139.   argument is assumed to be in WORDVAL.
  140.  
  141.   If the optional language is not specified, the current default
  142.   language is assumed.
  143.  
  144.   Formerly, to call a higher-level language routine, the
  145.   arguments needed to be explicitly PUSHed onto the stack, and
  146.   the stack needed to be explicitly adjusted (after the call)
  147.   depending on the language. The new CALL extensions save you
  148.   the tedium of doing all this explicitly.
  149.  
  150.  
  151.                  --PUSH, POP instruction extensions--
  152.  
  153.   The PUSH and POP instructions have been extended in Turbo
  154.   Assembler to allow more than one argument to appear in a
  155.   single PUSH or POP instruction. For example,
  156.  
  157.     push ax dx       ;equivalent to PUSH AX then PUSH DX
  158.     pop  dx ax       ;equivalent to POP DX then POP AX
  159.  
  160.   In addition, the PUSH instruction allows constant arguments
  161.   even when generating code for the 8086 processor. Such
  162.   instructions are replaced in the object code by a 10-byte
  163.   sequence that simulates the 80186/286/386 PUSH immediate
  164.   value instruction.
  165.  
  166.  
  167.                           --COMM extension--
  168.  
  169.   The COMM directive has been extended to allow the array
  170.   element size and the array element count to be selected
  171.   independently of each other for FAR communal variables.
  172.   This supports Turbo C++'s inline code generation, and
  173.   can be used advantageously by a native assembly language
  174.   programmer. The syntax is as follows:
  175.  
  176.     COMM FAR <id>{[<array element size multiplier>]}:<basic element
  177.              size>{:<array count>}
  178.  
  179.   For example, this code fragment reserves an array of size
  180.   410: 10 elements each of size 41 bytes:
  181.  
  182.     COMM FAR ABC[41]:BYTE:10
  183.  
  184.  
  185.              --Generalized line-continuation character--
  186.  
  187.   In TASM 2.0, a line-continuation feature has been added that
  188.   works in TASM's Ideal mode and is available even when the MASM
  189.   5.1 mode is off. A backslash (\) can be placed almost anywhere
  190.   as a line-continuation character. It cannot be used to break up
  191.   strings or identifiers. Its meaning is "read the next line in at
  192.   this point and continue processing." It can thus be used in a
  193.   natural way without losing the ability to comment each line as
  194.    desired. For example,
  195.  
  196.     foo mystructure  \    ;Start of structure fill.
  197.     <0               \    ;Zero value is first.
  198.     1,               \    ;One value.
  199.     2>                    ;Two value and end of structure.
  200.  
  201.   There are contexts where the line-continuation character is
  202.   not recognized. In general, it isn't recognized in any context
  203.   where characters are treated as text rather than identifiers,
  204.   numbers, or strings, or in MASM mode when the line continuation
  205.   is used in the first two symbols in the statement. For example,
  206.  
  207.     ifdif <123\>,<456\>
  208.  
  209.   does not recognize the two enclosed line-continuation characters.
  210.  
  211.     comment \
  212.     :
  213.  
  214.   begins a comment block, but does not define a near symbol
  215.   called COMMENT.
  216.  
  217.   The line-continuation character is also not recognized
  218.   inside of macro definitions. It is recognized, however,
  219.   when the macro is expanded.
  220.  
  221.  
  222.                         --Additional display--
  223.  
  224.   TASM 2.0 displays the number of passes as well as the error and
  225.   warning counts and remaining space. This allows you to assess
  226.   the amount of work TASM is putting into the compilation process.
  227.  
  228.  
  229.        --Language-specific procedures, extrns, publics, calls--
  230.  
  231.   TASM 2.0 allows procedures, publics, extrns, and calls to be
  232.   overridden with a language specifier. This causes wide
  233.   flexibility in writing assembler code that interfaces with
  234.   multiple language models. The MODEL statement has also been
  235.   extended.
  236.  
  237.   Here are some syntax examples:
  238.  
  239.     <procname> PROC {<language modifier>} {<language>} {NEAR | FAR}
  240.                                                           {args and uses}
  241.     EXTRN {<language>} <symbol>:<distance>, {<language>} 
  242.                                                   <symbol>:<distance>,...
  243.     PUBLIC {<language>} <symbol>, ...
  244.     COMM {<language>} <symbol>:<distance>, ...
  245.     GLOBAL {<language>} <symbol>:<distance>, ...
  246.     PUBLICDLL {<language>} <symbol>, ...
  247.     CALL <procname> {{<language>}, {args}}
  248.     .MODEL {<model modifier>} <model> {<module name>} {, 
  249.         {<language modifier>} <language> {, <language modifier> } }
  250.  
  251.    Here's the syntax for the IDEAL mode PROC statement:
  252.  
  253.     PROC {<language modifier>} {<language>} <procname> {NEAR | FAR}
  254.                                                           {args and uses}
  255.  
  256.     Legal models are TINY, SMALL, MEDIUM, COMPACT, LARGE, and HUGE.
  257.     Note that TPASCAL is also a legal model.
  258.  
  259.     Legal model modifiers are
  260.  
  261.     o FARSTACK (Selects model where SS is not assumed to be
  262.                 in DGROUP)
  263.  
  264.     o NEARSTACK (Selects model where SS is in DGROUP. This
  265.                  is the default)
  266.  
  267.     Legal languages are NOLANGUAGE, C, PASCAL, BASIC, FORTRAN,
  268.     and PROLOG.
  269.  
  270.     Legal language modifiers are
  271.  
  272.     o NORMAL (Selects normal procedure entry/exit sequences)
  273.  
  274.     o WINDOWS (Selects MSWindows procedure entry/exit sequences)
  275.  
  276.   You don't need the .MODEL statement to make use of any of these
  277.   language specifiers; the .MODEL statement simply serves to set
  278.   the default language.
  279.  
  280.  
  281.                   --New MODEL identifiers: WINDOWS--
  282.  
  283.   Here is a description of the model modifier SS_NE_DS and the
  284.   language modifiers NORMAL and WINDOWS.
  285.       
  286.   The model modifier can precede any use of a model keyword.
  287.   This only happens in the .MODEL statement. For example,
  288.       
  289.      .MODEL SS_NE_DS LARGE   ;Equivalent to TC's default large model
  290.       
  291.   This modifier causes SS to be assumed to NOTHING and the stack,
  292.   if any, to not be part of DGROUP.
  293.       
  294.   The language modifiers can precede any use of a language keyword.
  295.   A language keyword can be used in any of the following places:
  296.   .MODEL, EXTRN, GLOBAL, PUBLIC, PUBLICDLL, COMM, PROC, CALL.
  297.  
  298.   A language modifier affects the type of stack frame that's
  299.   generated for procedure entry and exit. When used in EXTRN,
  300.   GLOBAL, PUBLIC, PUBLICDLL, COMM, and CALL, a language modifier
  301.   is allowed but will have no effect.
  302.  
  303.   The stack frames actually generated for each modifier are as
  304.   follows:
  305.       
  306.     NORMAL: ;No entry/exit sequence generated if no args or locals.
  307.             ;8086 version (186 version uses ENTER/LEAVE).
  308.             push bp
  309.             mov bp,sp
  310.             sub sp,local_size       ;If any locals.
  311.             <push uses registers>
  312.             ...
  313.             <pop uses registers>
  314.             mov sp,bp               ;If any locals.
  315.             pop bp
  316.             ret
  317.  
  318.   WINDOWS: push ds
  319.            pop ax
  320.            xchg ax,ax
  321.            inc bp
  322.            push bp
  323.            mov bp,sp
  324.            push ds
  325.            mov ds,ax
  326.            sub sp,local_size       ;If any locals.
  327.            <push uses registers>
  328.            ...
  329.            <pop uses registers>
  330.            sub bp,2                ;If any locals.
  331.            mov sp,bp               ;If any locals.
  332.            pop ds
  333.            pop bp
  334.            dec bp
  335.            ret
  336.  
  337.   Here's an example:
  338.  
  339.     .MODEL large,windows pascal
  340.     .code
  341.  
  342.     foo proc
  343.     arg abc:word,def:word
  344.             xor ax,ax       ;Generates FAR WINDOWS PASCAL sequences.
  345.             ret
  346.     endp
  347.  
  348.     foo proc normal c
  349.     arg ghi:word,jkl:word
  350.             xor ax,ax       ;Generates FAR NORMAL C sequences.
  351.             ret
  352.     endp
  353.  
  354.  
  355.                            --VIRTUAL segments--
  356.  
  357.  
  358.   A new keyword VIRTUAL has been added to the SEGMENT
  359.   statement. VIRTUAL defines a special kind of segment
  360.   that will be treated as a common area and attached to
  361.   another segment at link time.
  362.  
  363.     <segname> SEGMENT VIRTUAL   ;In MASM mode.
  364.     ...
  365.     ENDS
  366.  
  367.     SEGMENT <segname> VIRTUAL   ;In Ideal mode.
  368.     ...
  369.     ENDS
  370.  
  371.   In TASM, the VIRTUAL segment is assumed to be attached to the
  372.   enclosing segment. The VIRTUAL segment also inherits its
  373.   attributes from the enclosing segment.
  374.  
  375.   A VIRTUAL segment is treated as normal except that it is
  376.   considered part of its parent segment for the purposes of
  377.   ASSUMEs.
  378.  
  379.   The linker treats virtual segments as a common area that will
  380.   be combined across modules. This permits static data that
  381.   comes into many modules from include files to be shared.
  382.  
  383.  
  384.                      --QASM compatibility additions--
  385.  
  386.   TASM 2.0 has new and modified directives to support source code
  387.   for QASM:
  388.  
  389.   .STARTUP and STARTUPCODE
  390.      These commands generate startup code for the particular
  391.      model in effect at the time. These also define the near
  392.      label @@Startup and cause the END statement at the end of
  393.      the module to generate the equivalent of 'END @@Startup'.
  394.      Note that only the 'STARTUPCODE' directive is available
  395.      in IDEAL mode.
  396.  
  397.   .MODEL and MODEL
  398.      It is now possible to select a third field in the .MODEL
  399.      statement to specify the stack association with DGROUP:
  400.      NEARSTACK or FARSTACK. For example, .MODEL SMALL,C,FARSTACK
  401.      would specify that the stack not be included in DGROUP.
  402.      This capability is already provided in TASM through the
  403.      language modifiers of the same name. The additional field
  404.      is provided only for MASM compatibility.
  405.  
  406.   Two new predefined variables have been added:
  407.  
  408.     Startup: Defined by the .STARTUP and STARTUPCODE directives.
  409.  
  410.     @Model: An integer representing the model currently in effect.
  411.             0 = TINY   1 = SMALL    2 = COMPACT    3 = MEDIUM
  412.             4 = LARGE  5 = HUGE
  413.  
  414.  
  415.                         --486 Instruction support--
  416.  
  417. The following directives have been added to TASM 2.0 to support
  418. the Intel 486 microprocessor:
  419.  
  420. .486,.486c (Masm mode only)
  421.  
  422. P486N: Enables assembly of non-protected instructions
  423.        for the 486 processor.
  424.  
  425. .486p (Masm mode only)
  426.  
  427. P486: Enables assembly of protected instructions
  428.       for the 486 processor.
  429.  
  430. BSWAP <32-bit register>: 486 byte swap instruction.
  431. XADD <r/m>,<reg>: 486 exchange and add instruction.
  432. CMPXCHG <r/m>,<reg>: 486 compare and exchange instruction.
  433. INVD: 486 invalidate data cache instruction.
  434. WBINVD: 486 write back and invalidate data cache inst.
  435. INVLPG <memptr>: 486 invalidate TLB entry for address inst.
  436.  
  437. The following test registers have also been added:
  438.  
  439. TR3,TR4,TR5
  440.  
  441.  
  442.                       --New TASM 2.0 error messages--
  443.  
  444.   TASM 2.0 reports several new error messages:
  445.  
  446.   Global type doesn't match symbol type
  447.     This warning is given when a symbol is declared
  448.     using the GLOBAL statement and is also defined in the
  449.     same module, but the type specified in the GLOBAL and
  450.     the actual type of the symbol don't agree.
  451.  
  452.   Illegal segment address
  453.     This error appears if an address greater than
  454.     65,535 is specified as a constant segment address;
  455.     for example,
  456.       FOO SEGMENT AT 12345h
  457.  
  458.   Module is pass-dependent--compatibility pass was done.
  459.     This warning occurs if a pass-dependent construction
  460.     was encountered and the /m command-line switch was
  461.     specified. A MASM-compatible pass was done.
  462.  
  463.   Near jump or call to different CS
  464.     This error occurs if the user attempts to
  465.     perform a NEAR CALL or JMP to a symbol that's
  466.     defined in an area where CS is assumed to a
  467.     different segment.
  468.  
  469.   Only one startup sequence allowed
  470.     This error appears if you have more than one
  471.     .STARTUP or STARTUPCODE statement in a module.
  472.  
  473.   Smart code generation must be enabled
  474.     Certain special features of code generation require
  475.     SMART code generation to be enabled. These include PUSH
  476.     of a pointer, POP of a pointer, and PUSH of a constant
  477.     (8086 only).
  478.  
  479.   Text macro expansion exceeds maximum line length
  480.     This error occurs when expansion of a text macro
  481.     causes the maximum allowable line length to be exceeded.
  482.  
  483.   USES has no effect without language
  484.     This warning appears if you specify a USES statement
  485.     when no language is in effect.
  486.  
  487.  
  488.                              --CODEPTR type--
  489.  
  490.   CODEPTR returns the default procedure address size depending
  491.   on the current model (WORD for models with NEAR code; DWORD
  492.   for models with FAR code). CODEPTR can be used wherever
  493.   DATAPTR is used. Here is its syntax:
  494.  
  495.     CODEPTR expression
  496.  
  497.  
  498.                           --RETCODE instruction--
  499.  
  500.   The RETCODE instruction is exactly equivalent to RETN or RETF,
  501.   depending on the specified model. RETCODE syntax follows:
  502.  
  503.     RETCODE {<expression>}
  504.  
  505.   RETCODE is available in both MASM and Ideal modes.
  506.  
  507.  
  508.                              --SMART/NOSMART--
  509.  
  510.   The SMART/NOSMART directives control the generation of
  511.   optimized object code. These are the areas that the SMART
  512.   and NOSMART directives apply to:
  513.  
  514.     1) OR, AND, or XOR of a signed immediate byte
  515.     2) PUSH <constant>
  516.     3) PUSH <large pointer>
  517.        POP <large pointer>
  518.     4) CALL <far address in same segment>
  519.     5) JMP <far address in same segment>
  520.     6) LEA <constant effective address>
  521.  
  522.   The default condition is SMART enabled. When SMART is
  523.   enabled, a qualifying FAR jump will be replaced by a NEAR or a
  524.   SHORT jump. Also, when SMART is enabled, a qualifying FAR call
  525.   will be replaced by a PUSH CS instruction and a NEAR call. 
  526.  
  527.   When NOSMART is  selected, the following code generation
  528.   changes occur:
  529.  
  530.     a) AND, OR, XOR of an immediate word value are no longer done
  531.        using the signed-extended immediate byte version of these
  532.        instructions where possible, but rather the longer
  533.        immediate word version that MASM uses.
  534.  
  535.     b) PUSH of a constant value on the 8086 processor using the
  536.        special 10-byte code sequence (which preserves all registers
  537.        and flags) is not allowed.
  538.  
  539.     c) PUSH and POP of a DWORD memory variable (or PWORD variable
  540.        on a 386) are not allowed.
  541.  
  542.     d) Far JMPs and CALLs within the same segment are no longer
  543.        optimized by replacing the FAR JMP or CALL with the NEAR
  544.        version.
  545.  
  546.     e) LEA instructions that refer to a constant effective address
  547.        will no longer be converted to the equivalent MOV operations.
  548.  
  549.   For maximum MASM compatibility, you must select NOSMART and
  550.   QUIRKS.
  551.  
  552.                            --Overlay object code--
  553.  
  554.   The /o commmand-line option
  555.  
  556.   Function   Generates overlay code
  557.  
  558.   Syntax     {/o}
  559.  
  560.   Remarks    Turbo Assembler 2.0 supports overlays. Specifying
  561.              the /o switch on the command line causes overlay-
  562.              compatible fixups to be generated. When this switch
  563.              is used, 386 references to USE32 segments should not
  564.              be made since they won't link properly.
  565.  
  566.