Turbo assembler

from Wikipedia, the free encyclopedia
Turbo assembler
Basic data

developer Borland
Publishing year 1989
Current  version 5.0
operating system DOS , Microsoft Windows
category Assembler
License proprietary
Turbo Assembler product page ( Memento from October 23, 2010 in the Internet Archive )

The Turbo Assembler ( TASM ) is an assembler for x86 processors on the MS-DOS operating system . It was introduced by Borland in 1989 as part of Turbo C 2.0, but was also available as a separate package together with the Turbo Linker . To support the programmer , the Turbo Debugger from Borland was first available as a separate product and later in a package with the TASM . The last published version 5 also supported Windows 95 and NT and processors up to Pentium .

The Microsoft Macro Assembler was the predominant assembler for MS-DOS when the Turbo Assembler was published. The TASM and the MASM then together covered the need for assembler for IBM-PCs and IBM-PC-like systems almost alone. The TASM promises to remedy shortcomings of the MASM, better performance , and also realizes more flexible and extended functionality, e.g. B. in the use of procedures, symbols, and a more powerful set of instructions. In order to be able to translate assembler programs for the MASM as unchanged as possible, the TASM has various modes that set a different degree of compatibility with the MASM. In addition to the core components customary for assemblers (assembler and linker), it also provides various auxiliary and additional programs in the package.

Today the TASM is no longer developed due to lack of demand.

Components of the sales package

The Turbo Assembler was not designed initially as Borland standalone product. It was intended more for internal and external support / application for the inline programming of their then successful products such as Turbo C or Turbo Pascal .

The TASM was not delivered as a program file, but in many independent but coordinated modules. As with all assemblers, a separate text editor is superfluous and does not exist. It thus contains the following components:

In the core area, the indispensable pair of assembler (TASM.EXE) and linker (TLINK.EXE) . In addition, five other aid programs:

  • MAKE : A program management system for the automated assembly and linking of programs.
  • TLIB : A program for easier management and consolidation of individual object files (.OBJ) .
  • GREP : A Unix / Linux- identical program to search for text strings in files.
  • OBJXREF : A tool for creating cross references for object files.
  • TCREF : Same for source files.

Delphi

Current versions of Delphi still contain the latest TASM version 5.4 from 2010 as a command line version. TLink.exe does not seem to be included, however, since the object files generated can be integrated into Delphi or C ++ Builder projects.

Modes

The different modes of the TASM are due to the adaptation to and improvement of the MASM. They guarantee the programmer to work in familiar structures and an almost complete compatibility / assembly of MASM source code. You can switch between the different modes as often as you like within the program.

MASM mode

In this mode, the TASM behaves very similarly to the MASM, but without emulating any obvious errors of the MASM. This is the default setting. Most of the possibilities of MASM 5.1 are already implemented in the MASM mode (the name is a bit misleading here).

MASM 5.1

The MASM 5.1 instruction allows almost all of the slightly different options of version 5.1 of the MASM. The following capabilities are only available with the explicit MASM 5.1 instruction:

  • The statements SUBSTR , CATSTR , SIZESTR, and INSTR .
  • The possibility of line continuation with a backslash .
  • An alternate syntax for the LOCAL statement.

However, the following options are only available when MASM 5.1 and QUIRKS mode are activated at the same time.

  • Local labels defined with @@ which can be accessed with @F and @B.
  • The redefinition of variables in PROC blocks (this also applies to differences in the cooperation with the C language with regard to PROC names).

Quirks mode

In this mode, the MASM is also completely simulated with its known malfunction. Certain features of the MASM can be so problematic that they have not been implemented even in MASM and MASM 5.1 mode. However, in order to allow programmers to continue using these characteristics if necessary and to ensure full compatibility, the quirks mode was created. This mode can either be activated in the source file using the QUIRKS instruction or during assembly using the / QUIRKS command line option.

Ideal mode

This mode contains TASM-specific extensions and changes to the MASM syntax, with the aim of making the assembler code clearer and more consistent. With the IDEAL mode, Borland promises "to smooth the corners and edges of MASM programming a bit", as well as "translation (assembly) up to 30% faster". The options are extensions or changes to options that already exist under the MASM. There is a stricter check of data types , which enables the detection of errors which without this mode would only be detected at runtime . Furthermore, the mode implements a more consistent and understandable designation of operators and keywords. It also introduces a few new principles and commands. The TASM uses a new syntax which does not differ radically from that of the MASM. The differences are in detail:

Rules for tokens

The period (.) Must not be used within a symbol designation, but only as an operator for structure elements or in floating point numbers . That is why MASM symbols that begin with a period in TASM either begin with the percent sign (%) or without special characters, or have been renamed. For example:

% CREF instead of .CREF
CONST instead of .CONST
.ERRIF2 instead of .ERR2

The use of a decimal point is always mandatory in IDEAL mode . A floating point number with the value 1.0e7 would be represented as follows: FKZ DT 1.0e7. The simplified representation of the form FKZ DT 1e7, which is possible in MASM and MASM mode, is not permitted. This strictness prevents a possible misinterpretation of the MASM, which after some commands could translate this value as hexadecimal number 01E7 .

Global versus local

Structure elements are not defined globally in IDEAL mode and only exist within the respective structure. In contrast to the MASM mode, this enables the use of two identically named elements inside and outside a structure or in two different structures. The following code excerpt would be allowed with the use of the Article element in two structures, even despite the additional different data type ( DW - DB ).

STRUC WikipediaOne
article DW?
ENDS

STRUC WikipediaTwo
articles DB?
ENDS

example

A turbo assembler program that says "Merry Christmas!":

p8086
model small
dataseg
mymessage DB 'Frohe Weihnachten!',0
codeseg
startupcode
mov bx, SEG mymessage
mov es, bx
mov si, OFFSET mymessage
mov bx, 0
fetchcharacter:
mov DL, es:[si+bx]
cmp DL, 0
je ending
mov ah, 2
push bx
push si
push es
int 21h
pop es
pop si
pop bx
inc bx
jmp fetchcharacter
ending:
mov ah, 04ch
mov al, 0
int 21h
end

literature

  • Jörg Schieb , Michael Tischer: The great Turbo Assembler book . Data Becker, 1990, 2nd slightly changed edition, ISBN 3-89011-282-X
  • Peter Monadjemi: Turbo Assembler - The book to get you started . Addison-Wesley, 1992, ISBN 3-89319-225-5
  • Ernst-Wolfgang Dieterich: Turbo Assembler . R. Oldenbourg Verlag, 1993
  • Tom Swan: Mastering Turbo Assembler . Sams Publishing, 1995, ISBN 0-672-30526-7
  • Joachim Rohde, Marcus Roming: Assembler - basics of programming . mitp Verlag, 2006, 2nd edition, ISBN 3-8266-1469-0

Individual evidence

  1. ^ V. Rajaraman, S. Rajasekaran, T. Radhakrishnan: Essentials of Assembly Language Programming for the IBM PC . 2004, p. 5
  2. Trutz Eyke Podschun: The assembly book - basics, introduction and high-level language optimization . Addison-Wesley, 2002, ISBN 3-8273-1929-3 , p. 557
  3. Borland Turbo Assembler - User Manual , Volume 1, in the German translation by Alois Stocklauser. 2nd Edition. Heimsoeth software, Munich 1988, p. 579