Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z - Internet FAQ Archives

x86 Assembly Language FAQ - TASM

[ Usenet FAQs | Web FAQs | Documents | RFC Index | Cities ]
x86 Assembly Language FAQ - TASM
From: (Ben Lunt)
Subject: x86 Assembly Language FAQ - Borland TASM
Supersedes: <89sf4a$stn$>
Followup-To: alt.lang.asm,comp.lang.asm.x86
Date: 3 Mar 2004 23:04:44 MST
Organization: Forever Young Software
Lines: 392
Approved: news-answers-request@MIT.EDU
Distribution: world
Expires: Tue, 22 Jun 2004 23:59:59 GMT
Message-ID: <8b8v6c$n7i$>
Summary: This is the FAQ for the x86 Assembly Language programmers for the
alt.lang.asm and comp.lang.asm.x86 newsgroups. This particular section of the
FAQ contains x86 assembly information specific to the Inprise's Borland Turbo
Keywords: x86 Assembly Language ASM FAQ Inprise Borland TASM

See reader questions & answers on this topic! - Help others by sharing your knowledge
Archive-Name: assembly-language/x86/borland
Posting-Frequency: monthly (21st of every month)
Last-modified: 2004/03/03

Subject: 1. Introduction and Intent
This is the x86 Assembly Language FAQ for the comp.lang.asm.x86 and
alt.lang.asm newsgroups.  This FAQ is posted monthly on or about the
21st of the month to both newsgroups and news.answers, alt.answers and
comp.answers.  It also is archived at the normal FAQ archival site, and to SimTel and its mirror sites in the msdos/info
directory and Garbo and its mirrors in the pc/doc-net directory.  When
uploaded to SimTel or Garbo, the filenames are, where xx is
the two digit year, yy is the number of the month and z is t for text or
h for HTML format.  Lastly, the current version is available from my web
and mirrored at:

    Zipped down as text files:
    Zipped down as HTML documents:
Currently, this FAQ is broken into six sections.  The following are the
section filenames and the scope of each section of the FAQ.

assembly-language/x86/general/part1 - This is the basic portion of the
    FAQ that contains information of interest to all assembly language
    programmers.  In general, the information contained in this portion
    of the FAQ is not specific to any particular assembler.
assembly-language/x86/general/part2 - This is a continuation of the
    above FAQ.
assembly-language/x86/general/part3 - This is a continuation of the
    above FAQ.
assembly-language/x86/microsoft - This portion of the FAQ contains
    information specific for the Microsoft MASM.
assembly-language/x86/borland - This portion of the FAQ contains
    information specific for the Borland TASM.
assembly-language/x86/a86 - This portion of the FAQ contains information
    specific for the Shareware A86 Assembler and D86 Debugger.

The scope and content of this FAQ is to go beyond just answering the
frequently asked questions.  I am including pointers to assembly
language treasure troves that are hidden on the Internet.  I believe
that this will enhance the FAQ's value not only to the novices but also
to the old hands.

For the ease of determining what has changed since the last FAQ, the
Table of Contents will have "REVISED" at the end of the subject line for
all revised subjects.  If more than one FAQ revision has been missed,
the "Last Changed:" entry at the end of each subject can be used to
determine which subjects have been revised during the intervening

The information in this FAQ is free for all to use as long as you
acknowledge the source.  This FAQ can be reproduced in part or in its
entirety as long as the copyright is included.  This FAQ can be made
available on public servers, like ftp, gopher or WWW servers.  Please do
not modify the file, such as converting it into some other format,
without prior permission of the author.

All references to files and locations are in Uniform Resource Locators
(URLs) format.  Some web browser will be able to use these URLs directly
as hot links.  If the format is not clear to you, get RFC 1738.  It is
available from:

Suggestions for changes and comments are always welcome.  They can be
posted to either newsgroup or e-mailed directly to me.

This FAQ was created and maintained by Raymond Moon before I
took it over.  Many thanks to Ray for the effort in creating
this FAQ.  Even though most of the links and names have been changed
to mine, the credit still goes to Ray for the work he did.  Thanks Ray.

Author: Benjamin David Lunt,
Copyright 2004 - Forever Young Software
Last Changed: 3 Mar 2004

Return to the Table Of Contents------------------------------
Subject: 2. Table of Contents
1.  Introduction And Intent
2.  Table Of Contents                                           REVISED
3.  TASM Ideal Mode
4.  Inprise TASM Information
5.  Inprise Tools/Windows 95 Interworking Patches Available
6.  FREELIB, Version 3.0
7.  TASM Source Code Available on the Internet
8.  TASM Version 5.0 Patch
9.  Inprise's TASM Newsgroup
10. TASM MMX and 3DNow Macros                                   REVISED

Subject: 3. TASM Ideal Mode

TASM, Inpise's Borland Turbo Assembler, supports an alternative to MASM
emulation.  This is known as Ideal mode and provides several advantages
over MASM.  The key (questionable) disadvantage, of course, is that MASM
style assemblers cannot assemble Ideal mode programs.


Square brackets are used consistently to refer to memory contents.
Notice that size qualifiers are not necessary when TASM has enough
information by context to figure out the data size involved.  Here are
some examples without segment details:

    ByteVal db ?        ; "ByteVal" is name of byte variable
    mov ax, bx          ; OK:  Move value of BX to AX
    mov ax, [bx]        ; OK:  Move word at address BX to AX.  Size of
                        ; destination is used to generate proper object
                        ; code
    mov ax, [word bx]   ; OK:  Same as above with unnecessary size
                        ; qualifier
    mov ax, [word ptr bx]
                        ; OK:  Same as above with unnecessary size
                        ; qualifier and redundant pointer prefix
    mov al, [bx]        ; OK:  Move byte at address BX to AL.  Size of
                        ; destination is used to generate proper object
                        ; code
     mov [bx], al       ; OK:  Move AL to location BX
    mov ByteVal, al     ; Warning: "ByteVal" needs brackets
    mov [ByteVal], al   ; OK:  Move AL to memory location named
                        ;  "ByteVal"
    mov [ByteVal], ax   ; Error: unmatched operands
    mov al, [bx + 2]    ; OK:  Move byte from memory location BX + 2 to
                        ; AL
    mov al, bx[2]       ; Error: indexes must occur with "+" as above
    mov bx, Offset ByteVal
                        ; OK: Offset statement does not use brackets
    mov bx, Offset [ByteVal]
                        ; Error:  offset cannot be taken of the
                        ;  contents of memory
    lea bx, [ByteVal]   ; OK:  Load effective address of "ByteVal"
    lea bx, ByteVal     ; Error:  brackets required
    mov ax, 01234h      ; OK:  Move constant word to AX
    mov [bx], 012h      ; Warning: size qualifier needed to determine
                        ; whether to populate byte or word
    mov [byte bx], 012h ; OK:  constant 012h is moved to byte at
                        ;  address BX
    mov [word bx], 012h ; OK:  constant 012h is moved to word at
                        ;  address BX


Ideal mode handles structured records beautifully.  When referring to
structure members the dot operator is used.  The name to the left of the
dot is always the address of a structure and the name to right is always
a structure member.  Ideal mode permits member names to be duplicated in
different structures.  Here is a simple example, again without segment

    Struc PosType
        Row     dw  ?
        Col     dw  ?
    Ends PosType

    Union PosValType
        Pos     PosType ?
        Val     dd      ?
    Ends PosValType

    Point   PosValType ?

    mov [Point.Pos.Row], bx     ; OK:  Move BX to Row component of Point
    mov [Point.Pos.Row], bl     ; Error:  mismatched operands


Ideal mode enforces type-size checking even with indirect references.
Using the above structure, here is how indirection is handled.  BX is
assumed to point to an instance of PosValType in memory.  Indirection is
used frequently when pointers are passed to procedures.

    mov [(PosValType bx).Pos.Row], ax
                        ; OK: Move AX to Row component of PosValType
                        ;  instance pointed to by BX
    mov [bx + PosValType.Pos.Row], ax
                        ; OK: same as above
    mov [bx + PosValType.Pos.Row], al
                        ; Error:  mismatched operands


The Offset operator always evaluates the offset of a data instance
relative to its group, not its segment.  This allows Offset to be used
without qualifying each reference with the appropriate group name.
Labels in a segment could be used to determine segment offsets if


Books and files which will be of interest to programmers wishing to know
more about the Ideal mode of Borland's TASM assembler include the

    Turbo Assembler User's Guide / Borland International.
    Naturally, this is the definitive text on Ideal mode.  Its focus is
    strictly on using TASM; it does not cover assembly language or the
    x86 instruction set.  Exasperatingly, the examples in the book all
    use MASM emulation mode, and only one of the four complete program
    examples included with TASM (at least version 3.1) uses Ideal mode.
    The example that does use Ideal mode is a very flexible WHEREIS
    program.  Studying this 13 file example should be sufficient for
    anyone wishing to understand Ideal mode.

    Mastering Turbo Assembler / Tom Swan.
    Indianapolis, IN:  Hayden Books, c 1989.
    This book is not just another Microsoft Assembler book reprinted
    with a Turbo Assembler cover.  Swan uses and promotes Ideal mode
    throughout.  This is a great beginning text for programmers who are
    still hassling with the ubiquitous non-reentrant interrupt handler
    known as DOS.  It includes an overview of the x86 instruction set.

    SKEL32.ZIP / Bill Magaletta.
    Obtainable by ftp at as well as and CompuServe
    This is a standalone 32 bit OS/2 Ideal mode program, the simplicity
    of which will make converts of DOS programmers dealing with
    interrupts and segments.  It includes an overview of the initial
    register states of DOS and OS/2 programs.  This example illustrates
    the fact that TASM for DOS can be used to produce object files for

Contributor: Kurt Jung,
Last changed: 17 Jan 95

Return to the Table Of Contents------------------------------
Subject: 4. Inprise Borland TASM Information
4.1  Inprise FTP Site

Borland maintains a ftp site which has a directory dedicated to TASM.
Most entries are patches and HOW-TOs, but there is a shell for TSRs that
will load and unload either high or low.

4.2  Inprise Web Site

At Borland's Web Site, I only could find a factsheet on TASM.  Most
information was found in the Borland C++ Quick Tour.  Click on the TASM
icon in the lower right

Contributor: Ray Moon,
Last changed: 23 Nov 98

Return to the Table Of Contents------------------------------
Subject: 5. Inprise Tools/Windows 95 Interworking Patches Available

Using the 32bit tools from Borland C++ 4.5 / TASM 4.0 under Windows 95
can fail when the DOS based tools are called from the Windows IDE.

The nature of the problem is that any attempt to specify a commands file
using the @ style argument will fail due to an incompatibility between
Windows 95 long filenames, and the TASM32.EXE file-open code.

Note that by default the Borland C++ 4.5 IDE uses the @ directive for
launching TASM32.EXE if 32bit instructions (which are not handled by the
inline C++ assembler) are encountered in a user's source.

Although the Borland tools reportedly use the PowerPack DPMI extensions
for their 32bit operation, user applications which use the Powerpack
libraries do not seem to be affected by this problem.

A patch is available to correct this issue from location:

This should be applied using the patcher executable from location:

Some people experience problems using the normal version 3.20 PATCH
program on systems running NTFS.  This version should be used only under
Windows NT, and only if there have been immediate crashes using the
regular version.  The URL for this version is:

Contributor: Iain Barker,
Last changed: 19 Feb 96

Return to the Table Of Contents------------------------------
Subject: 6. FREELIB, Version 3.0
Freelib v3.0 is a library of 200 routines that may be useful for
assembly language programming.  Freelib includes routines that do many
of the tasks that make assembly language difficult - like buffered file
I/O, formatted string output, memory allocation, etc.  Also includes
16.16bit fixed point arithmetic, text screen output (EGA 80x25 or VGA
90x34), and VGA graphics in both 16 and 256 colors.  All routines are
highly optimized for size and speed, and average only 60 bytes each.
Full source code and documentation is included for all routines.
Freelib is public domain software, free for non-commercial use.  The
library is available from SimTel:

Contributor: Raymond Moon,
Last changed: 20 Dec 96

Return to the Table Of Contents------------------------------
Subject: 7. TASM Source Code Available on the Internet

The Assembly Snippets is a large collection of assembly language code
and other information.   Many files from the original 80XXX snippets,
the ASM0-Z collection, and the Aquila site are included.  All code is
99% guaranteed to compile under TASM.   This new release contains the
following items, among others:

  An object file disassembler       A 4971 byte Tetris game
  Several Conway LIFE programs      Assembly & Disassembly tables
  A demonstration of FakeMode       Several powerful editors
  A complete DOS extender           A Pentium optimization list
  A ModeX graphics library          Info for writing antivirus

You can download these rather large files from Programmer's Heaven:


Contributor: Raymond Moon,
Last changed: 24 Oct 99

Return to the Table Of Contents------------------------------
Subject: 8. TASM Version 5.0 Patch
8.1  TASM 5.0 PATCH 1 (152KB)

This patch will modify TD32.EXE and TASM32.EXE to support Borland C++
Builder applications.  The URL is:

Contributor: Raymond Moon,
Last changed: 26 Dec 97

Return to the Table Of Contents------------------------------
Subject 9. Inprise's Borland TASM Newsgroup
Inprise has created a whole family of newsgroups devoted to their
products.  One of these new newsgroups is devoted to TASM.  Its URL is

Contributor: Raymond Moon,
Last Changed: 26 Dec 97

Return to the Table Of Contents------------------------------
Subject 10. TASM MMX and 3DNow Macros
10.1  Normand Leclerc MMX Macros

Normand Leclerc has written some Turbo Assembler MMX macroes that are
based on Intel's IAMMX.INC definition file.  Transparent to the
programmer, they have been written to be used in IDEAL mode.  They can
be assembled with or without case sensitivity and support simplified
segmentation definitions.  The are available from:

Contributor: Normand Leclerc,
Last Changed: 20 Mar 97

Return to the Table Of Contents------------------------------
Subject 11. TASM IDE
Joost Vrielink has developed a Turbo Assembler IDE.  It is free for
downloading from his web site: [Broken]

The IDE is an editor just like WordPad, but compile/link/run/debug can
be accomplished with just one click.  It also has a built-in
dec/hex/bin/oct converter, and syntax highlighting is almost finished.
It is perfectly suited to make simple 16-bit DOS programs within the
Windows 95/98 environment.  Changes are being added quite often, so
remember to return and check every now and then.

Contributor:Raymond Moon,
Last Changed: 19 Sep 98

Return to the Table Of Contents

User Contributions:

Comment about this article, ask questions, or add new information about this topic:

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
"fys" <>

Last Update March 27 2014 @ 02:11 PM