INTRODUCTION
============
PIBASYNC.ARC is an archive file which contains a set of routines
for implementing fully-buffered asynchronous serial port I/O from
Turbo Pascal on the IBM PC and compatibles. The routines have
been extracted from my PibTerm v4.0 program and converted for
used with Turbo Pascal v4.0.
Features of PibAsync:
-- Both input and output buffering for the serial port, resulting
in improved performance especially under multitaskers
-- Buffer sizes are user-definable up to 32K bytes each for
the input and output ring buffers
-- Speeds up through 38400 baud
-- Support for Com1: through Com4:
-- The ability to re-define port addresses, base RS 232
addresses, and IRQ lines for non-standard ports
-- Optional XON/XOFF handling at the interrupt level
-- Optional CTS/DSR handling at the interrupt level
-- Machine code (via INLINE) provides respectable speed for
the basic functions
Limitation:
-- Only one serial port is supported at a time. It would be
an interesting project for someone to provide multiple
simultaneous port access.
ARCHIVE CONTENTS
================
The following 18 files should be present in PIBASYNC.ARC:
ASCII.GLO --- Some Ascii character set definitions
ASYINT.ASM --- ASM source for asynchronous handler
ASYNCREC.ASM --- ASM source for receive-a-character routine
ASYNCSEN.ASM --- ASM source for send-a-character routine
DUMBTRM.PAS --- Sample dumb terminal emulator
FDELAY.ASM --- ASM source for 1 ms delay calculation
FIXBRACK.PAS --- Routine for neatening .OBJ files produced
by the INLINE assembler.
GLOBTYPE.GLO --- Global declarations for non-async-related
variables needed by async code
GLOBTYPE.PAS --- Main program for unit GLOBTYPE.TPU.
MAKEDUMB.BAT --- Batch file which calls TPC to compile
DUMBTRM.PAS
PIBASYN1.MOD --- Asynchronous I/O routines, part 1
PIBASYN2.MOD --- Asynchronous I/O routines, part 2
PIBASYN3.MOD --- Asynchronous I/O routines, part 3
PIBASYNC.GLO --- Global declarations for async-related
variables
PIBASYNC.PAS --- Main program for PIBASYNC.TPU.
PIBTIMER.PAS --- Time of day interface routines
README.DOC --- What you're reading now
TIMEREC.ASM --- ASM source for receiving character with
delay
The .ASM files can be assembled with Dave Baldwin's program
INLINE.COM, which converts the assembler source to Turbo Pascal
INLINE statements. (You will need at least v2.11 of INLINE.COM
to correctly assemble this code.) The PIBASYN*.MOD files already
contain the processed assembler source, so you do not need to run
INLINE on the .ASM files unless you want to alter them.
COMPATIBILITY WITH PREVIOUS VERSIONS
====================================
The calling sequences of these revised routines are largely
compatible with those previously available as part of earlier
versions of PibTerm. If you used those earlier routines, you
should be able to convert to these (with a resulting increase in
efficiency) with very little trouble. The major important
changes are that the routines Async_Init and Async_Close now take
arguments.
In the conversion to Turbo Pascal v4.0, I took advantage of the
new availability of the WORD type to add 38400 baud. Hence,
routines in which the baud rate is passed as an argument
(Async_Open, Async_Reset) now have the baud rate as a WORD
instead of an INTEGER.
DOCUMENTATION
=============
See the documentation block headers for individual routines in
PIBASYN*.MOD for details on the calling sequences and usage of
the routines.
SAMPLE PROGRAM
==============
The DUMBTRM.PAS routine demonstrates how to use the PibAsync
routines to build a dumb terminal emulation program.
USE OF THE ROUTINES
===================
You may use these routines for any NON-COMMERCIAL purpose
whatsoever. If you change these routines, you MUST make the
revised source available. Many individuals used the code from
previous versions of PibTerm and incorporated interesting changes
in the async routines, but did NOT make the resulting changes
available in source form so that all of us could benefit. I take
a dim view of that; I have made this source code available so
that others can learn from what I have done (and correct my
mistakes). I expect you to provide the same courtesy in return.
SUPPORT
=======
Please realize that these routines are not a commercial effort
and that I simply cannot afford the time or money to individually
support users. I WILL NOT return phone calls about these
routines, and I WILL NOT fix your code for you.
There are a number of commercial packages of asynchronous
routines available for Turbo Pascal. If you need a package for
commercial development, you should consider one of them.
You may send messages to me as indicated below, if you wish. I
will not necessarily answer all queries individually, however.
COMMENTS, ETC.
==============
You may send comments to me via one of the following means. I
may not answer all messages individually. Also, I don't check
for mail in these systems every day, so don't expect that a
message will reach me in less than a couple of weeks (except via
BITNET).
BITNET: PIB@NUACC.BITNET
CompuServe: CIS ID 72437,62
BBSs:
Gene Plantz's BBS (subscription only)
Ron Fox's BBS (312) 940 6496 (open)
Bob Blacher's BBS (202) 547 2008 (open)
-- Thanks,
Phil Burns 11/01/86
Changes for v4.1 of these routines:
===================================
I corrected delay loops by avoiding the use of a Turbo run-time
library variable. This 1-millesecond delay variable changed
meaning at v3.02 of Turbo, causing the various delay loops in
PibAsync to run incorrectly (for too short a time). I now
calculate and use my own delay loop value, independent of
Turbo's.
-- Phil Burns 12/27/86
Changes for v4.2 of these routines:
===================================
A couple of routines incorrectly left a word on the stack that
should have been popped in cases when the circular buffers were
full. Those problems have been fixed in this version.
-- Phil Burns 01/24/86
Changes for v4.3 of these routines:
===================================
The send routine incorrectly tested for the wrong circular buffer
pointer when the output buffer was full. This resulted in output
buffer overruns with lots of attendant nasty problems.
-- Phil Burns 03/25/87
Changes for v4.4 of these routines:
===================================
The code to setup mark and space parity was incorrect. This has
been corrected in this version.
-- Phil Burns 07/20/87
Changes for v4.5 of these routines:
===================================
I have converted the async routines to a UNIT for v4.0 of Turbo
Pascal.
To use the async routines, just do a
USES
DOS, PIBASYNC;
You don't need to include the code at all. Just compile
PIBASYNC.PAS and place the resulting PIBASYNC.TPU in your unit
include subdirectory.
38400 baud is now supported.
I've altered the character send routine to wait for a slot before
overwriting an existing buffer character when the output buffer
is full, rather than overwriting and then waiting.
The code to support serial ports 3 and 4 has been corrected.
Make sure to call Async_Setup_Port before using ports 3 and 4, or
when you're using a non-standard port address on ports 1 and 2.
Async_Setup_Port will now insert the port address you specify at
the proper offset from $0:$400, the address of the 8250. If you
set port address = -1, the default port address is used; if you
set irq = -1, then the default IRQ is used. The new function
Async_Port_Address_Given can be used to check if the RS232 base
address is installed in memory or not.
The preprocessor symbol MTASK should be defined if you are using
these routines in conjunction with the PIBMDOS routines for
interfacing to multitaskers.
The routines DOS_Set_Intrpt and DOS_Get_Intrpt have been removed
and replaced by the standard TP4 routines GetIntVec and
SetIntVec, respectively.
The batch file MAKEDUMB.BAT makes the DUMBTRM.EXE sample program
using the command line compiler (TPC.EXE).
-- Phil Burns 11/11/87
|