home *** CD-ROM | disk | FTP | other *** search
/ ftp.pasteur.org/FAQ/ / ftp-pasteur-org-FAQ.zip / FAQ / assembly-language / x86 / borland < prev    next >
Encoding:
Text File  |  2000-03-22  |  17.1 KB  |  422 lines

  1. Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!howland.erols.net!pants.skycache.com.MISMATCH!triton.skycache.com!portc01.blue.aol.com!portc.blue.aol.com!feed.newsreader.com!news!not-for-mail
  2. From: raymoon@ms1.dgsys.com (Raymond Moon)
  3. Newsgroups: alt.lang.asm,comp.lang.asm.x86,news.answers,alt.answers,comp.answers
  4. Subject: x86 Assembly Language FAQ - Borland TASM
  5. Supersedes: <89sf3j$stn$5@news.dgsys.com>
  6. Followup-To: alt.lang.asm,comp.lang.asm.x86
  7. Date: 21 Mar 2000 23:04:17 GMT
  8. Organization: MoonWare
  9. Lines: 396
  10. Approved: news-answers-request@MIT.EDU
  11. Distribution: world
  12. Expires: Thu, 20 Apr 2000 23:59:59 GMT
  13. Message-ID: <8b8v5h$n7i$5@news.dgsys.com>
  14. Reply-To: raymoon@moonware.dgsys.com
  15. NNTP-Posting-Host: dgs.dgsys.com
  16. X-Trace: news.dgsys.com 953679857 23794 207.154.12.1 (21 Mar 2000 23:04:17 GMT)
  17. X-Complaints-To: usenet@news.dgsys.com
  18. NNTP-Posting-Date: 21 Mar 2000 23:04:17 GMT
  19. Summary: This is the FAQ for the x86 Assembly Language programmers for
  20.  the alt.lang.asm and comp.lang.asm.x86 newsgroups.  This particular
  21.  section of the FAQ contains x86 assembly information specific to the
  22.  Inprise's Borland Turbo assembler.
  23. Keywords: x86 Assembly Language ASM FAQ Inprise Borland TASM
  24. X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
  25. Xref: senator-bedfellow.mit.edu alt.lang.asm:25274 comp.lang.asm.x86:83707 news.answers:179903 alt.answers:47944 comp.answers:40156
  26.  
  27. Archive-Name: assembly-language/x86/borland
  28. Posting-Frequency: monthly (21st of every month)
  29. Last-modified: 2000/03/20
  30.  
  31. ------------------------------
  32.  
  33. Subject: 1. Introduction and Intent
  34.  
  35. This is the x86 Assembly Language FAQ for the comp.lang.asm.x86 and
  36. alt.lang.asm newsgroups.  This FAQ is posted monthly on or about the
  37. 21st of the month to both newsgroups and news.answers, alt.answers and
  38. comp.answers.  It also is archived at the normal FAQ archival site,
  39. ftp://rtfm.mit.edu and to SimTel and its mirror sites in the msdos/info
  40. directory and Garbo and its mirrors in the pc/doc-net directory.  When
  41. uploaded to SimTel or Garbo, the filenames are asmxxyyz.zip, where xx is
  42. the two digit year, yy is the number of the month and z is t for text or
  43. h for HTML format.  Lastly, the current version is available from my web
  44. page as:
  45.     As text files:
  46.         http://www2.dgsys.com/~raymoon/faq/asmfaq.zip
  47.     As HTML documents:
  48.         http://www2.dgsys.com/~raymoon/faq/asmfaqh.zip
  49. Currently, this FAQ is broken into six sections.  The following are the
  50. section filenames and the scope of each section of the FAQ.
  51.  
  52. assembly-language/x86/general/part1 - This is the basic portion of the
  53.     FAQ that contains information of interest to all assembly language
  54.     programmers.  In general, the information contained in this portion
  55.     of the FAQ is not specific to any particular assembler.
  56. assembly-language/x86/general/part2 - This is a continuation of the
  57.     above FAQ.
  58. assembly-language/x86/general/part3 - This is a continuation of the
  59.     above FAQ.
  60. assembly-language/x86/microsoft - This portion of the FAQ contains
  61.     information specific for the Microsoft MASM.
  62. assembly-language/x86/borland - This portion of the FAQ contains
  63.     information specific for the Borland TASM.
  64. assembly-language/x86/a86 - This portion of the FAQ contains information
  65.     specific for the Shareware A86 Assembler and D86 Debugger.
  66.  
  67. The scope and content of this FAQ is to go beyond just answering the
  68. frequently asked questions.  I am including pointers to assembly
  69. language treasure troves that are hidden on the Internet.  I believe
  70. that this will enhance the FAQÆs value not only to the novices but also
  71. to the old hands.
  72.  
  73. For the ease of determining what has changed since the last FAQ, the
  74. Table of Contents will have "REVISED" at the end of the subject line for
  75. all revised subjects.  If more than one FAQ revision has been missed,
  76. the "Last Changed:" entry at the end of each subject can be used to
  77. determine which subjects have been revised during the intervening
  78. period.
  79.  
  80. The information in this FAQ is free for all to use as long as you
  81. acknowledge the source.  This FAQ can be reproduced in part or in its
  82. entirety as long as the copyright is included.  This FAQ can be made
  83. available on public servers, like ftp, gopher or WWW servers.  Please do
  84. not modify the file, such as converting it into some other format,
  85. without prior permission of the author.
  86.  
  87. All references to files and locations are in Uniform Resource Locators
  88. (URLs) format.  Some web browser will be able to use these URLs directly
  89. as hot links.  If the format is not clear to you, get RFC 1738.  It is
  90. available from:
  91.     http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1738.txt
  92.  
  93. Suggestions for changes and comments are always welcome.  They can be
  94. posted to either newsgroup or e-mailed directly to me.
  95.  
  96. Author: Raymond Moon, raymoon@moonware.dgsys.com
  97. Copyright 2000 - Raymond Moon
  98. ALL RIGHTS RESERVED
  99. Last Changed: 5 Feb 2000
  100.  
  101. ------------------------------
  102.  
  103. Subject: 2. Table of Contents
  104.  
  105. 1.  Introduction And Intent
  106. 2.  Table Of Contents                                           REVISED
  107. 3.  TASM Ideal Mode
  108. 4.  Inprise TASM Information
  109. 5.  Inprise Tools/Windows 95 Interworking Patches Available
  110. 6.  FREELIB, Version 3.0
  111. 7.  TASM Source Code Available on the Internet
  112. 8.  TASM Version 5.0 Patch
  113. 9.  InpriseÆs TASM Newsgroup
  114. 10. TASM MMX and 3DNow Macros                                   REVISED
  115. 11. TASM IDE
  116.  
  117. ------------------------------
  118.  
  119. Subject: 3.  TASM Ideal Mode
  120.  
  121. 3.1  SUMMARY
  122.  
  123. TASM, Inpise's Borland Turbo Assembler, supports an alternative to MASM
  124. emulation.  This is known as Ideal mode and provides several advantages
  125. over MASM.  The key (questionable) disadvantage, of course, is that MASM
  126. style assemblers cannot assemble Ideal mode programs.
  127.  
  128. 3.2  MEMORY CONTENTS
  129.  
  130. Square brackets are used consistently to refer to memory contents.
  131. Notice that size qualifiers are not necessary when TASM has enough
  132. information by context to figure out the data size involved.  Here are
  133. some examples without segment details:
  134.  
  135.     ByteVal db ?        ; "ByteVal" is name of byte variable
  136.     mov ax, bx          ; OK:  Move value of BX to AX
  137.     mov ax, [bx]        ; OK:  Move word at address BX to AX.  Size of
  138.                         ; destination is used to generate proper object
  139.                         ; code
  140.     mov ax, [word bx]   ; OK:  Same as above with unnecessary size
  141.                         ; qualifier
  142.     mov ax, [word ptr bx]
  143.                         ; OK:  Same as above with unnecessary size
  144.                         ; qualifier and redundant pointer prefix
  145.     mov al, [bx]        ; OK:  Move byte at address BX to AL.  Size of
  146.                         ; destination is used to generate proper object
  147.                         ; code
  148.      mov [bx], al       ; OK:  Move AL to location BX
  149.     mov ByteVal, al     ; Warning: "ByteVal" needs brackets
  150.     mov [ByteVal], al   ; OK:  Move AL to memory location named
  151.                         ;  "ByteVal"
  152.     mov [ByteVal], ax   ; Error: unmatched operands
  153.     mov al, [bx + 2]    ; OK:  Move byte from memory location BX + 2 to
  154.                         ; AL
  155.     mov al, bx[2]       ; Error: indexes must occur with "+" as above
  156.     mov bx, Offset ByteVal
  157.                         ; OK: Offset statement does not use brackets
  158.     mov bx, Offset [ByteVal]
  159.                         ; Error:  offset cannot be taken of the
  160.                         ;  contents of memory
  161.     lea bx, [ByteVal]   ; OK:  Load effective address of "ByteVal"
  162.     lea bx, ByteVal     ; Error:  brackets required
  163.     mov ax, 01234h      ; OK:  Move constant word to AX
  164.     mov [bx], 012h      ; Warning: size qualifier needed to determine
  165.                         ; whether to populate byte or word
  166.     mov [byte bx], 012h ; OK:  constant 012h is moved to byte at
  167.                         ;  address BX
  168.     mov [word bx], 012h ; OK:  constant 012h is moved to word at
  169.                         ;  address BX
  170.  
  171. STRUCTURE REFERENCES
  172.  
  173. Ideal mode handles structured records beautifully.  When referring to
  174. structure members the dot operator is used.  The name to the left of the
  175. dot is always the address of a structure and the name to right is always
  176. a structure member.  Ideal mode permits member names to be duplicated in
  177. different structures.  Here is a simple example, again without segment
  178. details:
  179.  
  180.     Struc PosType
  181.         Row     dw  ?
  182.         Col     dw  ?
  183.     Ends PosType
  184.  
  185.     Union PosValType
  186.         Pos     PosType ?
  187.         Val     dd      ?
  188.     Ends PosValType
  189.  
  190.     Point   PosValType ?
  191.  
  192.     mov [Point.Pos.Row], bx     ; OK:  Move BX to Row component of Point
  193.     mov [Point.Pos.Row], bl     ; Error:  mismatched operands
  194.  
  195. INDIRECTION
  196.  
  197. Ideal mode enforces type-size checking even with indirect references.
  198. Using the above structure, here is how indirection is handled.  BX is
  199. assumed to point to an instance of PosValType in memory.  Indirection is
  200. used frequently when pointers are passed to procedures.
  201.  
  202.     mov [(PosValType bx).Pos.Row], ax
  203.                         ; OK: Move AX to Row component of PosValType
  204.                         ;  instance pointed to by BX
  205.     mov [bx + PosValType.Pos.Row], ax
  206.                         ; OK: same as above
  207.     mov [bx + PosValType.Pos.Row], al
  208.                         ; Error:  mismatched operands
  209.  
  210. SEGMENT GROUPS
  211.  
  212. The Offset operator always evaluates the offset of a data instance
  213. relative to its group, not its segment.  This allows Offset to be used
  214. without qualifying each reference with the appropriate group name.
  215. Labels in a segment could be used to determine segment offsets if
  216. needed.
  217.  
  218. RESOURCES
  219.  
  220. Books and files which will be of interest to programmers wishing to know
  221. more about the Ideal mode of Borland's TASM assembler include the
  222. following:
  223.  
  224.     Turbo Assembler User's Guide / Borland International.
  225.     -------------------------------------------------------------------
  226.     Naturally, this is the definitive text on Ideal mode.  Its focus is
  227.     strictly on using TASM; it does not cover assembly language or the
  228.     x86 instruction set.  Exasperatingly, the examples in the book all
  229.     use MASM emulation mode, and only one of the four complete program
  230.     examples included with TASM (at least version 3.1) uses Ideal mode.
  231.     The example that does use Ideal mode is a very flexible WHEREIS
  232.     program.  Studying this 13 file example should be sufficient for
  233.     anyone wishing to understand Ideal mode.
  234.     
  235.     Mastering Turbo Assembler / Tom Swan.
  236.     Indianapolis, IN:  Hayden Books, c 1989.
  237.     ------------------------------------------------------------------
  238.     This book is not just another Microsoft Assembler book reprinted
  239.     with a Turbo Assembler cover.  Swan uses and promotes Ideal mode
  240.     throughout.  This is a great beginning text for programmers who are
  241.     still hassling with the ubiquitous non-reentrant interrupt handler
  242.     known as DOS.  It includes an overview of the x86 instruction set.
  243.     
  244.     SKEL32.ZIP / Bill Magaletta.
  245.     Obtainable by ftp at hobbes.nmsu.edu:/os2/32bit/program as well as
  246.     ftp-os2.cdrom.com and CompuServe
  247.     ------------------------------------------------------------------
  248.     This is a standalone 32 bit OS/2 Ideal mode program, the simplicity
  249.     of which will make converts of DOS programmers dealing with
  250.     interrupts and segments.  It includes an overview of the initial
  251.     register states of DOS and OS/2 programs.  This example illustrates
  252.     the fact that TASM for DOS can be used to produce object files for
  253.     OS/2.
  254.  
  255. Contributor: Kurt Jung, kwjung@vela.acs.oakland.edu
  256. Last changed: 17 Jan 95
  257.  
  258. ------------------------------
  259.  
  260. Subject: 4.  Inprise Borland TASM Information
  261.  
  262. 4.1  Inprise FTP Site
  263.  
  264. Borland maintains a ftp site which has a directory dedicated to TASM.
  265. Most entries are patches and HOW-TOs, but there is a shell for TSRs that
  266. will load and unload either high or low.
  267.  
  268.     ftp://ftp.inprise.com/pub/borlandcpp/devsupport/tasm/
  269.  
  270. 4.2  Inprise Web Site
  271.  
  272. At Borland's Web Site, I only could find a factsheet on TASM.  Most
  273. information was found in the Borland C++ Quick Tour.  Click on the TASM
  274. icon in the lower right
  275.  
  276. Contributor: Ray Moon, raymoon@moonware.dgsys.com
  277. Last changed: 23 Nov 98
  278.  
  279. ------------------------------
  280.  
  281. Subject: 5.  Inprise Tools/Windows 95 Interworking Patches Available
  282.  
  283. 5.1  TASM32/H2ASM/H2ASM32 FAIL UNDER WINDOWS95
  284.  
  285. Using the 32bit tools from Borland C++ 4.5 / TASM 4.0 under Windows 95
  286. can fail when the DOS based tools are called from the Windows IDE.
  287.  
  288. The nature of the problem is that any attempt to specify a commands file
  289. using the @ style argument will fail due to an incompatibility between
  290. Windows 95 long filenames, and the TASM32.EXE file-open code.
  291.  
  292. Note that by default the Borland C++ 4.5 IDE uses the @ directive for
  293. launching TASM32.EXE if 32bit instructions (which are not handled by the
  294. inline C++ assembler) are encountered in a user's source.
  295.  
  296. Although the Borland tools reportedly use the PowerPack DPMI extensions
  297. for their 32bit operation, user applications which use the Powerpack
  298. libraries do not seem to be affected by this problem.
  299.  
  300. A patch is available to correct this issue from location:
  301.     ftp://ftp.inprise.com/pub/borlandcpp/devsupport/patches/tasm/ta4p01.zip
  302.  
  303. This should be applied using the patcher executable from location:
  304.  
  305.     ftp://ftp.inprise.com/pub/borlandcpp/devsupport/patches/bc5/patch.zip
  306.  
  307. Some people experience problems using the normal version 3.20 PATCH
  308. program on systems running NTFS.  This version should be used only under
  309. Windows NT, and only if there have been immediate crashes using the
  310. regular version.  The URL for this version is:
  311.     ftp://ftp.inprise.com/pub/borlandcpp/devsupport/patches/bc5/patch-nt.zip
  312.  
  313. Contributor: Iain Barker, ibarker@bnr.ca
  314. Last changed: 19 Feb 96
  315.  
  316. ------------------------------
  317.  
  318. Subject:  6. FREELIB, Version 3.0
  319.  
  320. Freelib v3.0 is a library of 200 routines that may be useful for
  321. assembly language programming.  Freelib includes routines that do many
  322. of the tasks that make assembly language difficult - like buffered file
  323. I/O, formatted string output, memory allocation, etc.  Also includes
  324. 16.16bit fixed point arithmetic, text screen output (EGA 80x25 or VGA
  325. 90x34), and VGA graphics in both 16 and 256 colors.  All routines are
  326. highly optimized for size and speed, and average only 60 bytes each.
  327. Full source code and documentation is included for all routines.
  328. Freelib is public domain software, free for non-commercial use.  The
  329. library is available from SimTel:
  330.  
  331.     ftp://ftp.simtel.net/pub/simtelnet/msdos/asmutl/freeli30.zip
  332.  
  333. Contributor: Raymond Moon, raymoon@moonware.dgsys.com
  334. Last changed: 20 Dec 96
  335.  
  336. ------------------------------
  337.  
  338. Subject:  7. TASM Source Code Available on the Internet
  339.  
  340. 7.1  TENIE REMMELÆS ASSEMBLY SNIPPETS CODE COLLECTION
  341.  
  342. The Assembly Snippets is a large collection of assembly language code
  343. and other information.   Many files from the original 80XXX snippets,
  344. the ASM0-Z collection, and the Aquila site are included.  All code is
  345. 99% guaranteed to compile under TASM.   This new release contains the
  346. following items, among others:
  347.  
  348.   An object file disassembler       A 4971 byte Tetris game
  349.   Several Conway LIFE programs      Assembly & Disassembly tables
  350.   A demonstration of FakeMode       Several powerful editors
  351.   A complete DOS extender           A Pentium optimization list
  352.   A ModeX graphics library          Info for writing antivirus
  353.  
  354. You can download these rather large files from ProgrammerÆs Heaven:
  355.  
  356. http://www.programmershaven.com/zone5/cat20/1404.htm
  357.  
  358. Contributor: Raymond Moon, raymoon@moonware.dgsys.com
  359. Last changed: 24 Oct 99
  360.  
  361. ------------------------------
  362.  
  363. Subject:  8. TASM Version 5.0 Patch
  364.  
  365. 8.1  TASM 5.0 PATCH 1 (152KB)
  366.  
  367. This patch will modify TD32.EXE and TASM32.EXE to support Borland C++
  368. Builder applications.  The URL is:
  369.     http://www.borland.com/devsupport/borlandcpp/patches/TASMPT.ZIP
  370.  
  371. Contributor: Raymond Moon, raymoon@moonware.dgsys.com
  372. Last changed: 26 Dec 97
  373.  
  374. ------------------------------
  375.  
  376. Subject 9.  Inprise's Borland TASM Newsgroup
  377.  
  378. Inprise has created a whole family of newsgroups devoted to their
  379. products.  One of these new newsgroups is devoted to TASM.  Its URL is
  380.  
  381.     news:forums.inprise.com/borland.public.tasm
  382.  
  383. Contributor: Raymond Moon, raymoon@moonware.dgsys.com
  384. Last Changed: 26 Dec 97
  385.  
  386. ------------------------------
  387.  
  388. Subject 10.  TASM MMX and 3DNow Macros
  389.  
  390. 10.1  Normand Leclerc MMX Macros
  391.  
  392. Normand Leclerc has written some Turbo Assembler MMX macroes that are
  393. based on Intel's IAMMX.INC definition file.  Transparent to the
  394. programmer, they have been written to be used in IDEAL mode.  They can
  395. be assembled with or without case sensitivity and support simplified
  396. segmentation definitions.  The are available from:
  397.  
  398.     ftp://ftp.simtel.net/pub/simtelnet/msdos/asmutl/mmxtasm0.zip
  399.  
  400. 10.2
  401. Contributor: Normand Leclerc, lecn1306@ele.etsmtl.ca
  402. Last Changed: 20 Mar 97
  403.  
  404. ------------------------------
  405.  
  406. Subject 11.  TASM IDE
  407.  
  408. Joost Vrielink has developed a Turbo Assembler IDE.  It is free for
  409. downloading from his web site:
  410.     http://tasm.freeservers.com/
  411.  
  412. The IDE is an editor just like WordPad, but compile/link/run/debug can
  413. be accomplished with just one click.  It also has a built-in
  414. dec/hex/bin/oct converter, and syntax highlighting is almost finished.
  415. It is perfectly suited to make simple 16-bit DOS programs within the
  416. Windows 95/98 environment.  Changes are being added quite often, so
  417. remember to return and check every now and then.
  418.  
  419. Contributor:Raymond Moon, raymoon@moonware.dgsys.com
  420. Last Changed: 19 Sep 98
  421.  
  422.