[comp.lang.pascal] TP4.0 Aux Prob.

jc58+@andrew.cmu.edu (Johnny J. Chin) (11/11/88)

I just typed in the code on pages 365 - 367 of the Turbo Pascal 4.0 manual,
compiled it and tried to use it; but it doesn't seem to work.  Has anyone
else had this problem?  Is there a typo in the manual?

I'm referring to the procedures on using the Auxillary port on the PC.
AuxInit, AssignAux, ... , etc.

Does anybody know of a way to effectively send and receive one character at
a time from the RS232 port using Turbo Pascal?  This is what I need to do.

Thanks.

-- J. Chin (a.k.a. Computer Dr.)

------------------------- Carnegie Mellon University -------------------------
4730 Centre Avenue, Apt. #412       ARPAnet: Johnny.J.Chin@andrew.cmu.edu
Pittsburgh, Pennslyvania 15213      BITnet:  jc58@andrew.BITNET
(412) 268-8936                      UUCP: ...!harvard!andrew.cmu.edu!jc58
------------------------------------------------------------------------------

mlw@pyr.gatech.EDU ( Michael Williams) (11/13/88)

    The demo Aux program in the TP4.0 manual is incorrect.  There is a
corrected version called AUXINOUT.PAS on the TP4.0 UTIL/EXAMPLES disk.
On the same disk there are two programs, CPASDEMO.C and CPASDEMO.PAS
that give an example of calling TC functions from TP.  The same two
files are also on the TC1.5 "Integrated Development Env." disk.  I
hope this helps.

Michael Williams
Georgia Tech

milne@ics.uci.edu (Alastair Milne) (11/13/88)

>I just typed in the code on pages 365 - 367 of the Turbo Pascal 4.0 manual,
> ...

   Could you please recheck your page reference?  pp. 365-367 in my manual
   discusses the inline statement; the only code is a small routine, FillWord,
   at the bottom of 366.  

   Assuming you meant the AuxInOut unit that is given several pages further
   on (p. 373): no, it doesn't compile as given.  The reason is hinted 
   in the paragraph after the end.

   When they use TextRec, they use 2 fields that they call Port and Params.
   However, just as the paragraph says, these aren't in Turbo's TextRec 
   definition (it's on p. 298 in my manual).  The paragraph claims that
   AuxInOut defines them, replacing the UserData field with them; but it 
   doesn't!  AuxInOut contains no re-definition at all of TextRec. 

   To get my version to compile, I made Port and Param private globals.  This
   will work if AuxInOut is used only with one file.  Or you can try making
   your own local redefinition of TextRec as they describe.

   I haven't tried using it since a) I am using the serial port to write this
   message and b) I don't know how the Params argument should be used.

   I do feel that this is rather careless: the golden rule is always to try
   your examples before you publish them.  They could hardly have tried this
   one!


   Alastair Milne

reino@euraiv1.UUCP (Reino de Boer) (11/15/88)

jc58+@andrew.cmu.edu (Johnny J. Chin) writes:


>I just typed in the code on pages 365 - 367 of the Turbo Pascal 4.0 manual,
>compiled it and tried to use it; but it doesn't seem to work.  Has anyone
>else had this problem?  Is there a typo in the manual?

In my manual these pages are 373-376, and yes there is a typo.
The .DOC file on the distribution disks tells you to look at a file named
AUXINOUT.PAS on Disk II.

>I'm referring to the procedures on using the Auxillary port on the PC.
>AuxInit, AssignAux, ... , etc.

>Does anybody know of a way to effectively send and receive one character at
>a time from the RS232 port using Turbo Pascal?  This is what I need to do.

See also my posting in this group on Serial Unit in TP4.

>Thanks.

You're welcome

-- 
Reino de Boer
Erasmus Universiteit Rotterdam The Netherlands.
Vakgroep AIV 
reino@euraiv1.uucp  [All hail Discordia]

abcscnuk@csuna.UUCP (Naoto Kimura) (11/17/88)

In article <17499@adm.BRL.MIL> milne@ics.uci.edu (Alastair Milne) writes:
>>I just typed in the code on pages 365 - 367 of the Turbo Pascal 4.0 manual,
>> ...
>
>   Could you please recheck your page reference?  pp. 365-367 in my manual
>   discusses the inline statement; the only code is a small routine, FillWord,
>   at the bottom of 366.  
>
>   Assuming you meant the AuxInOut unit that is given several pages further
>   on (p. 373): no, it doesn't compile as given.  The reason is hinted 
>   in the paragraph after the end.

Gee...  That's strange...  What I see on page 373 is the first page of
Chapter 27 "Turbo Pascal Reference Lookup."    The AuxInOut unit appears on
pp. 365-367 in my manual.   FillWord appears on page 359 in the manual that
I have.  Maybe we're talking about different printings of the manual ?

>   When they use TextRec, they use 2 fields that they call Port and Params.
>   However, just as the paragraph says, these aren't in Turbo's TextRec 
>   definition (it's on p. 298 in my manual).  The paragraph claims that
>   AuxInOut defines them, replacing the UserData field with them; but it 
>   doesn't!  AuxInOut contains no re-definition at all of TextRec. 
>
>   To get my version to compile, I made Port and Param private globals.  This
>   will work if AuxInOut is used only with one file.  Or you can try making
>   your own local redefinition of TextRec as they describe.

Mine compiled w/o any problem, but it didn't do anything for me.  It
fails miserably (computer hangs) unless you have the appropriate control
lines set to high or low -- instead of floating.  The BIOS routines used
by the unit expects those signals to go high or low on certain
conditions (it polls).

>   I haven't tried using it since a) I am using the serial port to write this
>   message and b) I don't know how the Params argument should be used.

If you want to know how to use the Params argument, see the hardware
reference manual or the DOS reference concerning the BIOS routines to
use the RS232 port.

>   I do feel that this is rather careless: the golden rule is always to try
>   your examples before you publish them.  They could hardly have tried this
>   one!
>
>
>   Alastair Milne

I think I'll post the rs232 unit file here since there will probably be
some requests later...

--- cut here ------ cut here ------ cut here ------ cut here ---
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	kbd_svc.pas
#	rs232.pas
#	tstRS232.pas
# This archive created: Thu Nov 17 02:15:09 1988
export PATH; PATH=/bin:$PATH
echo shar: extracting "'kbd_svc.pas'" '(9692 characters)'
if test -f 'kbd_svc.pas'
then
	echo shar: will not over-write existing file "'kbd_svc.pas'"
else
sed 's/^	X//' << \SHAR_EOF > 'kbd_svc.pas'
	X(*====================================================================*\
	X|| MODULE NAME:  KBD_SVC                                              ||
	X||                                                                    ||
	X|| DESCRIPTION:  This unit contains a few keyboard service routines.  ||
	X||                                                                    ||
	X|| DEPENDENCIES: DOS.TPU, CRT.TPU                                     ||
	X||                                                                    ||
	X|| LAST MOD ON:  8811.04                                              ||
	X\*====================================================================*)
	X
	X{$S+}    {Stack checking on}
	X{$N-}    {No numeric coprocessor}
	X
	XUnit kbd_svc;
	X
	XInterface
	X
	XUses
	X    Dos,crt;
	X
	Xconst
	X    (*----------------------------------------------------------------*\
	X    | These are masks used in determining and setting the shift keys.  |
	X    | They are to be used in conjunction with the "shiftkey_stat" and  |
	X    | "set_shiftkey_stat" routines.                                    |
	X    \*----------------------------------------------------------------*)
	X    _RGTSHIFT	= $01;
	X    _LFTSHIFT	= $02;
	X    _CTLSHIFT	= $04;
	X    _ALTSHIFT	= $08;
	X    _SCLLOCK	= $10;
	X    _NUMLOCK	= $20;
	X    _CAPLOCK	= $40;
	X    _INSMODE	= $80;
	X
	X    (*----------------------------------------------------------------*\
	X    | These are commonly used characters and strings, so I've declared |
	X    | them as constants here.                                          |
	X    \*----------------------------------------------------------------*)
	X    NUL		= #0;
	X    BS		= #8;
	X    TAB		= #9;
	X    LF		= #10;
	X    CR		= #13;
	X    XON		= #17;
	X    XOFF	= #19;
	X    CAN		= #24;
	X    ESC		= #27;
	X    NEWLINE	= #13#10;
	X
	X    (*----------------------------------------------------------------*\
	X    | The following are the character codes returned by getkey for the |
	X    | the specified key, along with a TRUE value to indicate that the  |
	X    | the character code is a special one, and not a normal one        |
	X    \*----------------------------------------------------------------*)
	X    CTRL_BREAK	= #00;
	X    BKTAB	= #15;
	X    A_Q		= #16;
	X    A_W		= #17;
	X    A_E		= #18;
	X    A_R		= #19;
	X    A_T		= #20;
	X    A_Y		= #21;
	X    A_U		= #22;
	X    A_I		= #23;
	X    A_O		= #24;
	X    A_P		= #25;
	X
	X    A_A		= #30;
	X    A_S		= #31;
	X    A_D		= #32;
	X    A_F		= #33;
	X    A_G		= #34;
	X    A_H		= #35;
	X    A_J		= #36;
	X    A_K		= #37;
	X    A_L		= #38;
	X
	X    A_Z		= #44;
	X    A_X		= #45;
	X    A_C		= #46;
	X    A_V		= #47;
	X    A_B		= #48;
	X    A_N		= #49;
	X    A_M		= #50;
	X
	X    FN1		= #59;
	X    FN2		= #60;
	X    FN3		= #61;
	X    FN4		= #62;
	X    FN5		= #63;
	X    FN6		= #64;
	X    FN7		= #65;
	X    FN8		= #66;
	X    FN9		= #67;
	X    FN10	= #68;
	X
	X    K_HOME	= #71;
	X    K_UP	= #72;
	X    K_PGUP	= #73;
	X    K_LFT	= #75;
	X
	X    K_RGT	= #77;
	X
	X    K_END	= #79;
	X    K_DN	= #80;
	X    K_PGDN	= #81;
	X    K_INS	= #82;
	X    K_DEL	= #83;
	X
	X    S_FN1	= #84;
	X    S_FN2	= #85;
	X    S_FN3	= #86;
	X    S_FN4	= #87;
	X    S_FN5	= #88;
	X    S_FN6	= #89;
	X    S_FN7	= #90;
	X    S_FN8	= #91;
	X    S_FN9	= #92;
	X    S_FN10	= #93;
	X
	X    C_FN1	= #094;
	X    C_FN2	= #095;
	X    C_FN3	= #096;
	X    C_FN4	= #097;
	X    C_FN5	= #098;
	X    C_FN6	= #099;
	X    C_FN7	= #100;
	X    C_FN8	= #101;
	X    C_FN9	= #102;
	X    C_FN10	= #103;
	X
	X    A_FN1	= #104;
	X    A_FN2	= #105;
	X    A_FN3	= #106;
	X    A_FN4	= #107;
	X    A_FN5	= #108;
	X    A_FN6	= #109;
	X    A_FN7	= #110;
	X    A_FN8	= #111;
	X    A_FN9	= #112;
	X    A_FN10	= #113;
	X
	X    C_PRTSC	= #114;		(* from TP 4.0 manual *)
	X
	X    C_K_LFT	= #115;
	X    C_K_RGT	= #116;
	X    C_K_END	= #117;
	X    C_K_PGDN	= #118;
	X    C_K_HOME	= #119;
	X    A_1		= #120;
	X    A_2		= #121;
	X    A_3		= #122;
	X    A_4		= #123;
	X    A_5		= #124;
	X    A_6		= #125;
	X    A_7		= #126;
	X    A_8		= #127;
	X    A_9		= #128;
	X    A_0		= #129;
	X    A_MINUS	= #130;
	X    A_EQUAL	= #131;
	X    C_K_PGUP	= #132;
	X
	X    FN11	= #133;		(* from TP 4.0 manual *)
	X    FN12	= #134;
	X    S_FN11	= #135;
	X    S_FN12	= #136;
	X    C_FN11	= #137;
	X    C_FN12	= #138;
	X    A_FN11	= #139;
	X    A_FN12	= #140;
	X
	X(*--------------------------------------------------------------------*\
	X| NAME:  flushkbd                                                      |
	X|                                                                      |
	X|     This routine flushes out the keyboard buffer.                    |
	X\*--------------------------------------------------------------------*)
	Xprocedure flushkbd;
	X
	X(*--------------------------------------------------------------------*\
	X| NAME:  scankey                                                       |
	X|                                                                      |
	X| This function is used for reading a keystroke from the keyboard      |
	X| device.   The return value of the function will be TRUE if the key   |
	X| read in was a special key (i.e. was prefixed by an NUL), and the     |
	X| keycode is returned in "key."                                        |
	X\*--------------------------------------------------------------------*)
	Xfunction scankey( var key : char ) : boolean;
	X
	X(*--------------------------------------------------------------------*\
	X| NAME:  shiftkey_stat                                                 |
	X|                                                                      |
	X| This function returns the shift key status.                          |
	X\*--------------------------------------------------------------------*)
	Xfunction shiftkey_stat : byte;
	X
	X(*--------------------------------------------------------------------*\
	X| NAME:  set_shiftkey_stat                                             |
	X|                                                                      |
	X| This procedure sets the shift key status.                            |
	X\*--------------------------------------------------------------------*)
	Xprocedure set_shiftkey_stat ( stat : byte );
	X
	X(*--------------------------------------------------------------------*\
	X| NAME:  chk_keys                                                      |
	X|                                                                      |
	X|    This routine is used to check for special keystrokes.   If the    |
	X| ESC key is pressed, the parameter abort will be set to TRUE, which   |
	X| otherwise will remain unchanged.   If XOFF is pressed, then this     |
	X| routine will wait until it detects a XON.                            |
	X\*--------------------------------------------------------------------*)
	Xprocedure chk_keys (var aborted : boolean);
	X
	XImplementation
	X
	X(*--------------------------------------------------------------------*\
	X| NAME:  flushkbd                                                      |
	X|                                                                      |
	X|     This routine flushes out the keyboard buffer.                    |
	X\*--------------------------------------------------------------------*)
	Xprocedure flushkbd;
	X    var
	X	c	: char;
	X    begin
	X	while keypressed do
	X	    c := readkey
	X    end;    (* flushkbd *)
	X
	X(*--------------------------------------------------------------------*\
	X| NAME:  scankey                                                       |
	X|                                                                      |
	X| This function is used for reading a keystroke from the keyboard      |
	X| device.   The return value of the function will be TRUE if the key   |
	X| read in was a special key (i.e. was prefixed by an NUL), and the     |
	X| keycode is returned in "key."                                        |
	X\*--------------------------------------------------------------------*)
	Xfunction scankey( var key : char ) : boolean;
	X    begin
	X	key := readkey;
	X	if keypressed and (key = NUL) then begin
	X	    key := readkey;
	X	    scankey := TRUE
	X	  end
	X	else scankey := FALSE
	X    end;    (* scankey *)
	X
	X(*--------------------------------------------------------------------*\
	X| NAME:  shiftkey_stat                                                 |
	X|                                                                      |
	X| This function returns the shift key status.                          |
	X\*--------------------------------------------------------------------*)
	Xfunction shiftkey_stat : byte;
	X    var
	X	regs : registers;
	X    begin
	X	regs.AH := $02;
	X	intr($16,Dos.Registers(regs));
	X	shiftkey_stat := regs.AL
	X    end;    (* shiftkey_stat *)
	X
	X(*--------------------------------------------------------------------*\
	X| NAME:  set_shiftkey_stat                                             |
	X|                                                                      |
	X| This procedure sets the shift key status.                            |
	X\*--------------------------------------------------------------------*)
	Xprocedure set_shiftkey_stat ( stat : byte );
	X    begin
	X	mem[$40:$17] := stat
	X    end;    (* set_shiftkey_stat *)
	X
	X(*--------------------------------------------------------------------*\
	X| NAME:  chk_keys                                                      |
	X|                                                                      |
	X|    This routine is used to check for special keystrokes.   If the    |
	X| ESC key is pressed, the parameter abort will be set to TRUE, which   |
	X| otherwise will remain unchanged.   If XOFF is pressed, then this     |
	X| routine will wait until it detects a XON.                            |
	X\*--------------------------------------------------------------------*)
	Xprocedure chk_keys (var aborted : boolean);
	X    var
	X	ch      : char;
	X    begin
	X	if keypressed then
	X	    if not scankey(ch) then
	X		if ch = ESC then aborted := TRUE
	X		else if ch = XOFF then
	X		    repeat
	X			if scankey(ch) then ch := NUL
	X			else aborted := (ch = ESC)
	X		    until aborted or (ch = XON)
	X    end;    (* chk_keys *)
	X
	XEnd.
SHAR_EOF
if test 9692 -ne "`wc -c < 'kbd_svc.pas'`"
then
	echo shar: error transmitting "'kbd_svc.pas'" '(should have been 9692 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'rs232.pas'" '(32122 characters)'
if test -f 'rs232.pas'
then
	echo shar: will not over-write existing file "'rs232.pas'"
else
sed 's/^	X//' << \SHAR_EOF > 'rs232.pas'
	Xunit RS232;
	X(*====================================================================*\
	X|| UNIT NAME:    RS232                                                ||
	X||                                                                    ||
	X|| DESCRIPTION:  This is a text file device driver for the RS232 port.||
	X||               The routines found in the book [Advanced Techniques  ||
	X||               Turbo Pascal] (by Charles C. Edwards) were used as a ||
	X||               pattern for these routines.    The routines in this  ||
	X||               unit are an adaptation of the Turbo 3.0 routines in  ||
	X||               the book.                                            ||
	X||                                                                    ||
	X|| DEPENDENCIES: Dos.TPU, Crt.TPU                                     ||
	X||                                                                    ||
	X|| LAST MOD:     8810.29                                              ||
	X\*====================================================================*)
	Xinterface
	X
	Xuses dos,crt;
	X
	Xconst
	X    (*----------------------------------------------------------------*\
	X    | The following constants are for use with the initialization      |
	X    | routines (AssignRS232 and RS_Initialize).  These constants are   |
	X    | to be ORed together to obtain the value to be passed as the      |
	X    | configuration byte.                                              |
	X    \*----------------------------------------------------------------*)
	X    (* Baud rate constants *)
	X    _COM_BAUD		= $E0;	(* ###- ---- *)
	X    _COM_110		= $00;	(* 000- ---- *)
	X    _COM_150		= $20;	(* 001- ---- *)
	X    _COM_300		= $40;	(* 010- ---- *)
	X    _COM_600		= $60;	(* 011- ---- *)
	X    _COM_1200		= $80;	(* 100- ---- *)
	X    _COM_2400		= $A0;	(* 101- ---- *)
	X    _COM_4800		= $C0;	(* 110- ---- *)
	X    _COM_9600		= $E0;	(* 111- ---- *)
	X
	X    (* Parity constants *)
	X    _COM_PARITY		= $18;	(* ---# #--- *)
	X    _COM_NOPARITY	= $00;	(* ---0 0--- *)
	X    _COM_ODDPARITY	= $08;	(* ---0 1--- *)
	X    _COM_NVRMNDPARITY	= $10;	(* ---1 0--- *)
	X    _COM_EVENPARITY	= $18;	(* ---1 1--- *)
	X
	X    (* Stop bits constants *)
	X    _COM_STOPBITS	= $04;	(* ---- -#-- *)
	X    _COM_STOP1		= $00;	(* ---- -0-- *)
	X    _COM_STOP2		= $04;	(* ---- -1-- *)
	X
	X    (* Character length constants *)
	X    _COM_CHRBITS	= $03;	(* ---- --## *)
	X    _COM_CHR5		= $00;	(* ---- --00 *)
	X    _COM_CHR6		= $01;	(* ---- --01 *)
	X    _COM_CHR7		= $02;	(* ---- --10 *)
	X    _COM_CHR8		= $03;	(* ---- --11 *)
	X
	X    (*----------------------------------------------------------------*\
	X    | The following constants are to be used along with the values     |
	X    | record type Setup.   These tables are defined for the sake of    |
	X    | being able to make a menu-driven interface to port               |
	X    | initialization routine.                                          |
	X    \*----------------------------------------------------------------*)
	X    _COM_NUMBAUD	= 8;
	X    _COM_BAUD_TBL	: array [0..7] of byte = (
	X				_COM_110,  _COM_150,
	X				_COM_300,  _COM_600,
	X				_COM_1200, _COM_2400,
	X				_COM_4800, _COM_9600
	X			);
	X    _COM_BAUD_STR	: array [0..7] of array [1..4] of char = (
	X				' 110', ' 150', ' 300',' 600',
	X				'1200', '2400', '4800','9600'
	X			);
	X    _COM_NUMPARITY	= 4;	(* number of supported parity values *)
	X    _COM_PARITY_TBL	: array [0..3] of byte = (
	X				_COM_NOPARITY,     _COM_ODDPARITY,
	X				_COM_NVRMNDPARITY, _COM_EVENPARITY
	X			);
	X    _COM_PARITY_STR	: array [0..3] of array [1..10] of char = (
	X				 '      None', '       Odd',
	X				'Don''t care', '      Even'
	X			);
	X    _COM_NUMSTOP	= 2;	(* number of supported stop bits *)
	X    _COM_STOP_TBL	: array [0..1] of byte = (
	X				_COM_STOP1, _COM_STOP2
	X			);
	X    _COM_STOP_VAL	: array [0..1] of byte = (
	X				1, 2
	X			);
	X    _COM_NUMCHR		= 4;	(* number of supported chr bit values *)
	X    _COM_CHR_TBL	: array [0..3] of byte = (
	X				_COM_CHR5, _COM_CHR6,
	X				_COM_CHR7, _COM_CHR8
	X			);
	X    _COM_CHR_VAL	: array [0..3] of byte = (
	X				5, 6, 7, 8
	X			);
	X
	X(*--------------------------------------------------------------------*\
	X| The following declarations are hardware related.                     |
	X\*--------------------------------------------------------------------*)
	Xtype
	X    (*----------------------------------------------------------------*\
	X    | The following record type is used to specify the port addresses  |
	X    | of the INS8250.                                                  |
	X    \*----------------------------------------------------------------*)
	X    INS8250 =	record
	X		    THR: word;	{Transmit Holding Register}
	X		    RBR: word;	{Receive  Holding Register}
	X		    IER: word;	{Interrupt Enable Register}
	X		    IIR: word;	{Interrupt Ident Register }
	X		    LCR: word;	{Line  Control Register   }
	X		    MCR: word;	{Modem Control Register   }
	X		    LSR: word;	{Line  Status Register    }
	X		    MSR: word;	{Modem Status Register    }
	X		    DLL: word;	{Divisor Latch Lsb        }
	X		    DLM: word	{Divisor Latch Msb        }
	X		end;
	X
	Xconst
	X    (*----------------------------------------------------------------*\
	X    | These are masks to be used with the Line Control Register        |
	X    \*----------------------------------------------------------------*)
	X    WL_MASK	= $03;		(* Word length select *)
	X    STB_MASK	= $04;		(* # Stop BiTs        *)
	X    PEN_MASK	= $08;		(* Parity ENable      *)
	X    EPS_MASK	= $10;		(* Even Parity Select *)
	X    STICKP_MASK	= $20;		(* Stick Parity       *)
	X    BRK_ON	= $40;		(* Set Break          *)
	X    DLAB_ON	= $80;		(* Divisor Latch      *)
	X
	X    (*----------------------------------------------------------------*\
	X    | These masks are for use with the Interrupt Enable Register       |
	X    \*----------------------------------------------------------------*)
	X    EN_DATAAVAIL= $01;	(* Data Available             *)
	X    EN_THREMPTY	= $02;	(* Transmit Holding Reg EMpty *)
	X    EN_RCV	= $04;	(* Receive Line Status        *)
	X    EN_MODEM	= $08;	(* Modem status               *)
	X
	X    (*----------------------------------------------------------------*\
	X    | These masks are for use with the Modem Control Register          |
	X    \*----------------------------------------------------------------*)
	X    MCR_DTR	= $01;	(* Set to bring output low *)
	X    MCR_RTS	= $02;
	X    OUT1	= $04;
	X    OUT2	= $08;
	X
	X    (*----------------------------------------------------------------*\
	X    | These masks are for use with the Modem Status Register           |
	X    \*----------------------------------------------------------------*)
	X    DSR_MASK	= $20;
	X    CTS_MASK	= $10;
	X
	X    (*----------------------------------------------------------------*\
	X    | These static variables are used to control the interpretation of |
	X    | the signal lines DSR (Data Set Ready) and CTS.                   |
	X    \*----------------------------------------------------------------*)
	X{static}
	X    RS_Error	: byte		= 0;
	X    Chk_DSR	: boolean	= FALSE;
	X    Chk_CTS	: boolean	= FALSE;
	X
	X(*--------------------------------------------------------------------*\
	X| NAME: AssignRS232                                                    |
	X|                                                                      |
	X|     This routine is used to associate a text file with a RS232 port. |
	X| Also set with this routine is the RS232 parameters (i.e. baud rate,  |
	X| stop bits, word bits, parity).                                       |
	X|                                                                      |
	X| Input parameters:                                                    |
	X|     F        - text file variable to be associated with an RS232     |
	X|                port.                                                 |
	X|     IO_port  - DOS COM port number (1 or 2)                          |
	X|     Params   - Configuration for RS232 port.  Generate this value by |
	X|                performing a bitwise "or" with the proper defined     |
	X|                constants.                                            |
	X\*--------------------------------------------------------------------*)
	Xprocedure AssignRS232(var F : text;  IO_port, Params : word);
	X
	X(*--------------------------------------------------------------------*\
	X| NAME: RS_Break                                                       |
	X|                                                                      |
	X|     This routine is used to generate a break signal on the RS232     |
	X| communications adapter.                                              |
	X\*--------------------------------------------------------------------*)
	Xprocedure RS_Break(var f : text );
	X
	X(*--------------------------------------------------------------------*\
	X| NAME: RS232inReady                                                   |
	X|                                                                      |
	X|     This routine is used to check if there is a character available  |
	X| in the input queue.                                                  |
	X\*--------------------------------------------------------------------*)
	Xfunction RS232inReady(var f : text) : boolean;
	X
	X(*--------------------------------------------------------------------*\
	X| NAME: RS_parms                                                       |
	X|                                                                      |
	X|     This routine returns a byte showing the status of the RS232 port |
	X| in a byte with the same format as is passed to the BIOS RS232 setup  |
	X| routine.  The output of this function is compatible with the RS232   |
	X| configuration word passed to "AssignRS232."                          |
	X\*--------------------------------------------------------------------*)
	Xfunction RS_Parms( Com : byte ) : byte;
	X
	X(*--------------------------------------------------------------------*\
	X| NAME: RS_Initialize                                                  |
	X|                                                                      |
	X|     This routine sets up parameters for the RS232 port.   This is to |
	X| be used after a file is associated with a RS232 port.                |
	X\*--------------------------------------------------------------------*)
	Xprocedure RS_Initialize( Com, Parms : byte );
	X
	X(*--------------------------------------------------------------------*\
	X| The following record type is used by the Get_RS_Setup routine to     |
	X| return the status of the RS232 port.                                 |
	X\*--------------------------------------------------------------------*)
	Xtype
	X    RS_Config	= record
	X			Com,
	X			Speed,
	X			Parity,
	X			Stop,
	X			Length	: byte
	X		  end;
	X
	X(*--------------------------------------------------------------------*\
	X| NAME: Get_RS_setup                                                   |
	X|                                                                      |
	X|     This routine can be called to obtain the setup parameters for    |
	X| the serial ports.    It returns them in the structure type RS_Config |
	X| which has each of the parameters separated out into separate bytes.  |
	X| This routine is provided to simplify writing an interface to the     |
	X| configuration of an RS232 port.   The values returned in the Setup   |
	X| record are compatible with the tables defined earlier.               |
	X\*--------------------------------------------------------------------*)
	Xprocedure Get_RS_Setup(
	X	var Remote_file	: text;
	X	var Setup	: RS_Config);
	X
	Ximplementation
	X
	X(*--------------------------------------------------------------------*\
	X| This record type shows the structure of the data stored in a file    |
	X| variable type in the UserData field.   It contains information on    |
	X| the comm port number and the initialization of the RS232 port        |
	X| associated with the text file.                                       |
	X\*--------------------------------------------------------------------*)
	Xtype
	X    RS232rec =	record
	X		    IO_port,Params	: word;
	X		    Unused		: array [1..12] of byte
	X		end;
	X
	X(*--------------------------------------------------------------------*\
	X| The following static variable contains the port addresses for the    |
	X| specified control/status register of the specified comm port.        |
	X\*--------------------------------------------------------------------*)
	Xconst (* really static var *)
	X    regs	: array [1..2] of INS8250 = (
	X	( THR:$3F8; RBR:$3F8; IER:$3F9; IIR:$3F9; LCR:$3FB;
	X	  MCR:$3FC; LSR:$3FD; MSR:$3FE; DLL:$3F8; DLM:$3F9  ),
	X	( THR:$2F8; RBR:$2F8; IER:$2F9; IIR:$2F9; LCR:$2FB;
	X	  MCR:$2FC; LSR:$2FD; MSR:$2FE; DLL:$2F8; DLM:$2F9  ));
	X
	X(*--------------------------------------------------------------------*\
	X| The following are declarations are for the input queue.  The         |
	X| interrupt service routines stuff characters into the tail of the     |
	X| queue and the input routines read from the head of the queue.        |
	X| The index for RSbufHead, RSbufTail, and the first index of RS_Buffer |
	X| is the DOS COM port with which the input is associated.              |
	X\*--------------------------------------------------------------------*)
	Xconst
	X    RS_BUF_SIZE = 8192;
	X
	Xvar
	X    RSbufHead,
	X    RSbufTail	: array [1..2] of integer;
	X    RS_Buffer	: array [1..2,0..RS_BUF_SIZE] of byte;
	X
	X(*--------------------------------------------------------------------*\
	X| The following are "inline macros" for doing various things.          |
	X|                                                                      |
	X|    RS232_Init          - Performs initialization of RS232 port       |
	X|    DisableInterrupts   \ Does exactly what name suggests             |
	X|    EnableInterrupts    /                                             |
	X\*--------------------------------------------------------------------*)
	Xprocedure RS232_Init(IO_port,Params:word);	(* internal macro *)
	Xinline(	$58/		{POP AX		;Pop parameters}
	X	$5A/		{POP DX		;Pop port number}
	X	$B4/$00/	{MOV AH,0	;Request port initialization}
	X	$CD/$14);	{INT 14H	;Call BIOS}
	X
	Xprocedure DisableInterrupts;			(* internal macro *)
	Xinline($FA);
	X
	Xprocedure EnableInterrupts;			(* internal macro *)
	Xinline($FB);
	X
	X{$F+}	(* force FAR (32bit) addrresing *)
	X
	X(*--------------------------------------------------------------------*\
	X| NAME: RS232_ISR1                                                     |
	X|                                                                      |
	X|     This is the interrupt service routine written to handle the      |
	X| RS232 port.   This routine is triggered by data being available for  |
	X| reading.                                                             |
	X|                                                                      |
	X| EXTERNALS: const     regs, RS_BUFFER_SIZE                            |
	X|            var       RS_Error, RS_Buffer, RS_BufTail                 |
	X|            procedure IssueEOI                                        |
	X\*--------------------------------------------------------------------*)
	X{static interrupt far} procedure COM1_ISR;
	X    interrupt;
	X    begin
	X	DisableInterrupts;
	X	RS_Error := port[regs[1].LSR] and $1E;
	X	RS_Buffer[1,RSbufTail[1]] := port[regs[1].RBR];
	X	RSbufTail[1] := (RSbufTail[1]+1) mod (RS_BUF_SIZE+1);
	X	EnableInterrupts;
	X	port[$20] := $20	{Clear interrupt flag}
	X    end;   (* COM1_ISR *)
	X
	X(*--------------------------------------------------------------------*\
	X| NAME: RS232_ISR2                                                     |
	X|                                                                      |
	X|     This is the interrupt service routine written to handle the      |
	X| RS232 port.   This routine is triggered by data being available for  |
	X| reading.                                                             |
	X|                                                                      |
	X| EXTERNALS: const     regs, RS_BUFFER_SIZE                            |
	X|            var       RS_Error, RS_Buffer, RS_BufTail                 |
	X|            procedure IssueEOI                                        |
	X\*--------------------------------------------------------------------*)
	X{static interrupt far} procedure COM2_ISR;
	X    interrupt;
	X    begin
	X	DisableInterrupts;
	X        RS_Error := port[regs[2].LSR] and $1E;
	X	RS_Buffer[2,RSbufTail[2]] := port[regs[2].RBR];
	X	RSbufTail[2] := (RSbufTail[2]+1) mod (RS_BUF_SIZE+1);
	X	EnableInterrupts;
	X	port[$20] := $20	{Clear interrupt flag}
	X    end;   (* COM2_ISR *)
	X
	X(*--------------------------------------------------------------------*\
	X| NAME:  RS232input                                                    |
	X|                                                                      |
	X|     This is the input handling routine for files assigned to the     |
	X| RS232 device.   This is an internal service routine and will not be  |
	X| directly used by any procedure outside of this unit.                 |
	X|                                                                      |
	X| EXTERNALS: const RS_BUFFER_SIZE                                      |
	X|            type  RS232rec                                            |
	X|            var   RS_BufHead, RS_BufTail, RS_Buffer                   |
	X\*--------------------------------------------------------------------*)
	X{static far} function RS232input(var f : textrec) : integer;
	X    var
	X	p : word;
	X    begin
	X	with f,RS232rec(UserData) do begin
	X	    p := 0;
	X	    while p<BufSize do begin
	X		while RSbufHead[IO_port]=RSbufTail[IO_port] do
	X		    delay(1);
	X		BufPtr^[p] :=
	X			char(RS_Buffer[IO_port,RSbufHead[IO_port]]);
	X		inc(p);
	X		RSbufHead[IO_port] := (RSbufHead[IO_port]+1)
	X 					mod (RS_BUF_SIZE+1)
	X	      end;
	X	    BufPos := 0;
	X	    BufEnd := p
	X	  end;
	X	RS232Input := 0
	X    end;   (* RS232input *)
	X
	X(*--------------------------------------------------------------------*\
	X| NAME:  RS232output                                                   |
	X|                                                                      |
	X|     This is the output handling routine for files assigned to the    |
	X| RS232 device.   This is an internal service routine and will not be  |
	X| directly used by any procedure outside of this unit.                 |
	X|                                                                      |
	X| EXTERNALS: const RS_BUFFER_SIZE, regs, DSR_MASK, CTS_MASK            |
	X|            type  RS232rec                                            |
	X|            var   Chk_DSR, Chk_CTS, RS_BufHead, RS_BufTail,           |
	X|                  RS_Buffer                                           |
	X\*--------------------------------------------------------------------*)
	X{static far} function RS232output(var f : textrec) : integer;
	X    var
	X	p	: word;
	X    begin
	X	with f,RS232rec(UserData) do begin
	X	    p := 0;
	X	    while p<BufPos do begin
	X		while ((port[regs[IO_port].LSR] and $20) <> $20) do
	X		    delay(1);
	X		(* Request To Send *)
	X		port[regs[IO_port].MCR] := MCR_RTS or OUT2;
	X		if Chk_DSR then
	X		    while ((port[regs[IO_port].MSR] and DSR_MASK)
	X			    <> DSR_MASK) do
	X			delay(1);
	X		if Chk_CTS then
	X		    while ((port[regs[IO_port].MSR] and CTS_MASK)
	X			    <> CTS_MASK) do
	X			delay(1);
	X		port[regs[IO_port].THR] := byte(BufPtr^[P]);
	X		inc(p)
	X	      end;
	X	    BufPos := 0
	X	  end;
	X	RS232output := 0
	X    end;   (* RS232output *)
	X
	X(*--------------------------------------------------------------------*\
	X| NAME:  RS232inpflush                                                 |
	X|                                                                      |
	X| This routine is used to flush the input buffer of the file           |
	X| associated with the text file.  This is an internal service routine  |
	X| and will not be directly used by any procedure outside of this unit. |
	X\*--------------------------------------------------------------------*)
	X{static far} function RS232inpflush( var f	: textrec ) : integer;
	X    begin
	X	with f,RS232rec(UserData) do begin
	X	    BufPos := 0;
	X            BufEnd := 0;
	X            RSbufHead[IO_port] := RSbufTail[IO_port]
	X	  end;
	X	RS232inpflush := 0
	X    end;    (* RS232inpflush *)
	X
	X(*--------------------------------------------------------------------*\
	X| NAME:  RS232ignore                                                   |
	X|                                                                      |
	X| This routine is used to perform a do-nothing function, usually for   |
	X| don't care conditions that may occur during I/O.  This is an         |
	X| internal service routine and will not be directly used by any        |
	X| procedure outside of this unit.                                      |
	X\*--------------------------------------------------------------------*)
	X{static far} function RS232ignore(var f : textrec) : integer;
	X    begin
	X	RS232ignore := 0
	X    end;   (* RS232ignore *)
	X
	Xconst
	X    IMR		= $21;
	X    IRQ4_MASK	= $EF;
	X    IRQ3_MASK	= $F7;
	X    COM1_INTR	= $0C;
	X    COM2_INTR	= $0B;
	X
	X(*--------------------------------------------------------------------*\
	X| NAME:  RS232open                                                     |
	X|                                                                      |
	X| This routine is used to open an input or output stream to an rs232   |
	X| device.   It is assumed that an AssignRS232 has been performed on    |
	X| the text file to set up the RS232 configuration for the text file    |
	X| This is an internal service routine and will not be directly used by |
	X| any procedure outside of this unit.                                  |
	X\*--------------------------------------------------------------------*)
	X{static far} function RS232open(var f : textrec) : integer;
	X    begin
	X	with f,RS232rec(UserData) do begin
	X	    BufPos := 0;
	X	    BufEnd := 0;
	X	    RS232_Init(IO_port,Params);
	X	    if IO_port = 1 then begin	(* set Interrupt Mask Reg *)
	X		port[IMR] := port[IMR] and IRQ4_MASK;
	X		SetIntVec(COM1_INTR,@COM1_ISR)
	X	      end
	X	    else begin
	X		port[IMR] := port[IMR] and IRQ3_MASK;
	X		SetIntVec(COM2_INTR,@COM2_ISR)
	X	      end;
	X	    port[regs[IO_port].LCR] :=
	X		port[regs[IO_port].LCR] and (not DLAB_ON);
	X	    port[regs[IO_port].IER] := EN_DATAAVAIL;
	X	    port[regs[IO_port].MCR] := OUT2;
	X	    If Mode=fmInput then begin
	X		InOutFunc := @RS232input;
	X		FlushFunc := @RS232ignore;
	X		BufSize := 1
	X	      end
	X	    else begin
	X		Mode := fmOutput;
	X		InOutFunc := @RS232output;
	X		FlushFunc := @RS232output
	X	      end;
	X	    CloseFunc := @RS232ignore
	X	  end;
	X	RS232open := 0
	X    end;   (* RS232open *)
	X
	X(*--------------------------------------------------------------------*\
	X| NAME: AssignRS232                                                    |
	X|                                                                      |
	X|     This routine is used to associate a text file with a RS232 port. |
	X| Also set with this routine is the RS232 parameters (i.e. baud rate,  |
	X| stop bits, word bits, parity).                                       |
	X|                                                                      |
	X| Input parameters:                                                    |
	X|     F        - text file variable to be associated with an RS232     |
	X|                port.                                                 |
	X|     IO_port  - DOS COM port number (1 or 2)                          |
	X|     Params   - Configuration for RS232 port.  Generate this value by |
	X|                performing a bitwise "or" with the proper defined     |
	X|                constants.                                            |
	X\*--------------------------------------------------------------------*)
	Xprocedure AssignRS232 (
	X	var F		: text;
	X	    IO_port,
	X	    Params	: word);
	X    begin
	X	with TextRec(f) do begin
	X	    Handle	:= $FFFF;
	X	    Mode	:= fmClosed;
	X	    BufSize	:= sizeof(Buffer);
	X	    BufPtr	:= @Buffer;
	X	    OpenFunc	:= @RS232Open;
	X	    RS232rec(UserData).IO_port := IO_port;
	X	    RS232rec(UserData).Params  := Params;
	X	    Name[0] := #0
	X	  end
	X    end;    (* AssignRS232 *)
	X
	X(*--------------------------------------------------------------------*\
	X| NAME: RS232inReady                                                   |
	X|                                                                      |
	X|     This routine is used to check if there is a character available  |
	X| in the input queue.                                                  |
	X|                                                                      |
	X| EXTERNALS: var RSBufHead, RSBufTail                                  |
	X\*--------------------------------------------------------------------*)
	Xfunction RS232inReady (var f : text) : boolean;
	X    begin
	X	with TextRec(f),RS232rec(UserData) do
	X	    RS232inReady := not (RSbufHead[IO_port]=RSbufTail[IO_port])
	X    end;   (* RS232inReady *)
	X
	X(*--------------------------------------------------------------------*\
	X| NAME: RS_Break                                                       |
	X|                                                                      |
	X|     This routine is used to generate a break signal on the RS232     |
	X| communications adapter.                                              |
	X|                                                                      |
	X| EXTERNALS: const regs                                                |
	X\*--------------------------------------------------------------------*)
	Xprocedure RS_Break( var f : text );
	X    begin
	X	with TextRec(f),RS232rec(UserData) do begin
	X	    port[regs[IO_port].LCR] :=
	X		port[regs[IO_port].LCR] or BRK_ON;
	X	    delay(200);		{ 1/5 second }
	X	    port[regs[IO_port].LCR] :=
	X		port[regs[IO_port].LCR] xor BRK_ON;
	X 	  end
	X    end;    (* RS_Break *)
	X
	X(*--------------------------------------------------------------------*\
	X| NAME: RS_parms                                                       |
	X|                                                                      |
	X|     This routine returns a byte showing the status of the RS232 port |
	X| in a byte with the same format as is passed to the BIOS RS232 setup  |
	X| routine.  The output of this function is compatible with the RS232   |
	X| configuration word passed to "AssignRS232."   The baud rate is       |
	X| determined by reading the Divisor latch and interpreting the         |
	X| contents (This table could be found in the IBM Technical Reference). |
	X|                                                                      |
	X| EXTERNALS: const regs, DLAB_ON, DLAB_OFF, _COM_110, _COM_150,        |
	X|                  _COM_300, _COM_600, _COM_1200, _COM_2400, _COM_4800,|
	X|                  WL_MASK, STB_MASK, PEN_MASK EPS_MASK                |
	X\*--------------------------------------------------------------------*)
	Xfunction RS_parms( Com : byte ) : byte;
	X    type
	X	wrd	= record
	X		  case boolean of
	X		  TRUE: (lobyte,hibyte	: byte);
	X		  FALSE:(wordval	: word)
	X		  end;
	X    var
	X	v	: wrd;
	X	retval	: byte;
	X    begin
	X	(* get baud rate *)
	X	port[regs[Com].LCR] := lo(port[regs[Com].LCR] or DLAB_ON);
	X	v.lobyte := port[regs[Com].DLL];
	X	v.hibyte := port[regs[Com].DLM];
	X	port[regs[Com].LCR] := lo(port[regs[Com].LCR] xor DLAB_ON);
	X	case integer(v.wordval) of
	X	$0900: retval :=         0;	(* >   50   *)
	X	$0600: retval :=         0;	(* >   75   *)
	X	$0417: retval :=  _COM_110;	(*    110   *)
	X	$0359: retval :=         0;	(* >  134.5 *)
	X	$0300: retval :=  _COM_150;	(*    150   *)
	X	$0180: retval :=  _COM_300;	(*    300   *)
	X	$00C0: retval :=  _COM_600;	(*    600   *)
	X	$0060: retval := _COM_1200;	(*   1200   *)
	X	$0040: retval :=         0;	(* > 1800   *)
	X	$003A: retval :=         0;	(* > 2000   *)
	X	$0030: retval := _COM_2400;	(*   2400   *)
	X	$0020: retval :=         0;	(* > 3600   *)
	X	$0018: retval := _COM_4800;	(*   4800   *)
	X	$0010: retval :=         0;	(* > 7200   *)
	X	$000C: retval := _COM_9600	(*   9600   *)
	X	else   retval := 0		(* >    ?   *)
	X	end;
	X	(* get word length, stop bits, and parity *)
	X	RS_parms := retval or (port[regs[Com].LCR]
	X				and (WL_MASK or STB_MASK or
	X					PEN_MASK or EPS_MASK ))
	X    end;
	X
	X(*--------------------------------------------------------------------*\
	X| NAME: RS_Initialize                                                  |
	X|                                                                      |
	X|     This routine sets up parameters for the RS232 port.  This is to  |
	X| be used after a file is associated with a RS232 port.                |
	X|                                                                      |
	X| EXTERNALS: const regs                                                |
	X|            var   RS_BufHead, RS_BufTail                              |
	X\*--------------------------------------------------------------------*)
	Xprocedure RS_Initialize ( Com, Parms : byte );
	X    begin
	X	RSbufHead[Com] := 0;
	X	RSbufTail[Com] := 0;
	X	RS232_Init(Com-1, Parms);
	X	if Com = 1 then
	X	    port[IMR] := port[IMR] and IRQ4_MASK
	X        else
	X	    port[IMR] := port[IMR] and IRQ3_MASK;
	X	port[regs[Com].LCR] :=
	X		port[regs[Com].LCR] and (not DLAB_ON);
	X	port[regs[Com].IER] := EN_DATAAVAIL;
	X	port[regs[Com].MCR] := OUT2
	X    end;
	X
	X(*--------------------------------------------------------------------*\
	X| NAME: Get_RS_setup                                                   |
	X|                                                                      |
	X|     This routine can be called to obtain the setup parameters for    |
	X| the serial ports.    It returns them in the structure type RS_Config |
	X| which has each of the parameters separated out into separate bytes.  |
	X| This routine is provided to simplify writing an interface to the     |
	X| configuration of an RS232 port.   The values returned in the Setup   |
	X| record are compatible with the tables defined earlier.               |
	X|                                                                      |
	X| EXTERNALS: const    _COM_BAUD, _COM_PARITY, _COM_STOPBITS,           |
	X|                     _COM_CHRBITS                                     |
	X|            type     RS_Config                                        |
	X|            function RS_parms                                         |
	X\*--------------------------------------------------------------------*)
	Xprocedure Get_RS_Setup(
	X	var Remote_file	: text;
	X	var Setup	: RS_Config);
	X    var
	X	parms	: byte;
	X    begin
	X	Setup.Com := RS232rec(TextRec(Remote_file).UserData).IO_port;
	X	parms := RS_Parms(Setup.Com);
	X	Setup.Speed  := (parms and _COM_BAUD) shr 5;
	X	Setup.Parity := (parms and _COM_PARITY) shr 3;
	X	Setup.Stop   := (parms and _COM_STOPBITS) shr 2;
	X	Setup.Length := parms and _COM_CHRBITS
	X    end;
	X
	Xconst
	X    ExitPtr	: pointer	= NIL;
	X    Old_IMR	: byte		= 0;
	X    Old_IER1	: byte		= 0;
	X    Old_IER2	: byte		= 0;
	X    OldIntvec1	: pointer	= NIL;
	X    OldIntvec2	: pointer	= NIL;
	X
	X(*--------------------------------------------------------------------*\
	X| NAME: RS232cleanup                                                   |
	X|                                                                      |
	X|     This routine is used to disable the interrupts from the port and |
	X| to restore the old interrupt vectors.   This is an internal support  |
	X| routine and will not be referenced by any external routines.         |
	X|                                                                      |
	X| EXTERNALS: const     regs                                            |
	X|            var       Old_IMR, OldRS_Vec1, OldRS_Vec2                 |
	X\*--------------------------------------------------------------------*)
	X{static far} procedure RS232cleanup;
	X    begin
	X	(* shut off interrupts *)
	X	port[IMR]:=lo(port[IMR] or (not IRQ4_MASK) or (not IRQ3_MASK));
	X	port[regs[1].LCR] := port[regs[1].LCR] and (not DLAB_ON);
	X	port[regs[1].IER] := Old_IER1;
	X	port[regs[2].LCR] := port[regs[2].LCR] and (not DLAB_ON);
	X	port[regs[2].IER] := Old_IER1;
	X	SetIntVec(COM1_INTR,OldIntvec1);
	X	SetIntVec(COM2_INTR,OldIntvec1);
	X	port[IMR] := Old_IMR;
	X	ExitProc := ExitPtr
	X    end;    (* RS232cleanup *)
	X
	Xbegin (* start of unit initializaton *)
	X    ExitPtr := ExitProc;
	X    Old_IMR := port[IMR];
	X    port[regs[1].LCR] := port[regs[1].LCR] and (not DLAB_ON);
	X    Old_IER1 := port[regs[1].IER];
	X    port[regs[2].LCR] := port[regs[2].LCR] and (not DLAB_ON);
	X    Old_IER2 := port[regs[2].IER];
	X    GetIntVec(COM1_INTR,OldIntvec1);
	X    GetIntVec(COM2_INTR,OldIntvec2);
	X    RSbufHead[1] := 0;
	X    RSbufHead[2] := 0;
	X    RSbufTail[1] := 0;
	X    RSbufTail[2] := 0;
	X    ExitProc := @RS232cleanup
	Xend.
SHAR_EOF
if test 32122 -ne "`wc -c < 'rs232.pas'`"
then
	echo shar: error transmitting "'rs232.pas'" '(should have been 32122 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'tstRS232.pas'" '(1019 characters)'
if test -f 'tstRS232.pas'
then
	echo shar: will not over-write existing file "'tstRS232.pas'"
else
sed 's/^	X//' << \SHAR_EOF > 'tstRS232.pas'
	Xprogram tstRS232;
	Xuses
	X    crt,rs232,kbd_svc;
	Xvar
	X    infile,
	X    outfile	: text;
	X    conf	: RS_Config;
	X    c		: char;
	X
	Xbegin
	X    assignRS232(infile,1,RS_parms(1));   reset(infile);
	X    assignRS232(outfile,1,RS_parms(1));  rewrite(outfile);
	X
	X    Get_RS_Setup(infile,conf);
	X    writeln('input: COM',conf.Com:1,' ',
	X		_COM_BAUD_STR[conf.Speed],' baud, ',
	X		'parity:',_COM_PARITY_STR[conf.Parity],',',
	X		_COM_STOP_VAL[conf.Stop],' stop bits, ',
	X		_COM_CHR_VAL[conf.Length],' word bits');
	X    Get_RS_Setup(outfile,conf);
	X    writeln('Output: COM',conf.Com:1,' ',
	X		_COM_BAUD_STR[conf.Speed],' baud, ',
	X		'parity:',_COM_PARITY_STR[conf.Parity],',',
	X		_COM_STOP_VAL[conf.Stop],' stop bits, ',
	X		_COM_CHR_VAL[conf.Length],' word bits');
	X
	X    c := NUL;
	X    repeat
	X	if RS232inReady(infile) then begin
	X	    read(infile,c);
	X	    write(c);
	X	    c := NUL
	X	  end;
	X	if keypressed then
	X	    if not scankey(c) then begin
	X		if c=CR then
	X		    writeln(outfile)
	X		else begin
	X		    write(outfile,c);
	X		  end;
	X	      end
	X    until c=^C
	Xend.
SHAR_EOF
if test 1019 -ne "`wc -c < 'tstRS232.pas'`"
then
	echo shar: error transmitting "'tstRS232.pas'" '(should have been 1019 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0
--- cut here ------ cut here ------ cut here ------ cut here ---

                //-n-\\				Naoto Kimura
        _____---=======---_____			(csun!csuna!abcscnuk)
    ====____\   /.. ..\   /____====
  //         ---\__O__/---         \\	Enterprise... Surrender or we'll
  \_\                             /_/	send back your *&^$% tribbles !!