TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Steven Hendriks
from: David Muir
date: 1995-08-05 06:30:46
subject: Serial I/O {5 of 10}

DosDevIOCtl(Fport,1,$67,tptr,1,retlength,{at}status,1,retlength);
   CTSActive := status and 16 = 16;
   end;

Function TX_free : word;
VAR
   tptr:pointer;
   retlength:longint;
BEGIN
   tptr := {at}BufferRec;
   DosDevIOCtl(Fport,1,$69,tptr,
               sizeof(BufferRec),retlength,tptr,sizeof(BufferRec),retlength);
   TX_free := BufferRec.FullSize-BufferRec.Bytesin;
   end;

Function RX_free : word;
VAR
   tptr:pointer;
   retlength:longint;
BEGIN
   tptr := {at}BufferRec;
   DosDevIOCtl(Fport,1,$68,tptr,
               sizeof(BufferRec),retlength,tptr,sizeof(BufferRec),retlength);
   RX_free := BufferRec.FullSize-BufferRec.Bytesin;
   end;

Function Waiting : Boolean;
VAR
   tptr:pointer;
   retlength:longint;
BEGIN
   tptr := {at}BufferRec;
   DosDevIOCtl(Fport,1,$68,tptr,
               sizeof(BufferRec),retlength,tptr,sizeof(BufferRec),retlength);
   Waiting := BufferRec.Bytesin>0;
   end;

Function SetBaud (Bitrate:word):word;
VAR
   B_rec:word;
   tptr:pointer;
   retlength:longint;
BEGIN
   tptr := {at}b_rec;
   DosDevIOCtl(Fport,1,$41,tptr,
               sizeof(b_rec),retlength,tptr,sizeof(b_rec),retlength);
   setBaud := b_rec;
   end;

Function GetBaud:word;
VAR
   B_rec:word;
   tptr:pointer;
   retlength:longint;
BEGIN
   tptr := {at}b_rec;
   DosDevIOCtl(Fport,1,$61,tptr,
               sizeof(b_rec),retlength,tptr,sizeof(b_rec),retlength);
   getBaud := b_rec;
   end;

Function SetEBaud (Bitrate:longint):longint;
TYPE
Bit_rec = Record
   rate:longint;
   frac:byte;
   end;
VAR
   B_rec:Bit_rec;
   tptr:pointer;
   retlength:longint;
BEGIN
   b_rec.rate := Bitrate;
   b_rec.frac := 0;
   tptr := {at}b_rec;
   DosDevIOCtl(Fport,1,$43,tptr,
               sizeof(b_rec),retlength,tptr,sizeof(b_rec),retlength);
   SetEBaud := b_rec.rate;
   end;

Function SetLine (D_bits,Parity,S_bits:byte): Boolean;
VAR
   B_rec:array[1..3] of byte;
   tptr:pointer;
   status:byte;
   retlength:longint;
BEGIN
   SetLine := false;
   tptr := {at}b_rec;
   if not ((D_Bits in [5,7,8]) and (Parity in [0..4]) and (S_bits in [0..2]))
      then exit;
   if ((S_bits=1) and (D_bits5)) then exit;
   b_rec[1] := D_bits;
   b_rec[2] := Parity;
   b_rec[3] := S_bits;
   Error := DosDevIOCtl(Fport,1,$42,tptr,
               sizeof(b_rec),retlength,tptr,sizeof(b_rec),retlength);
   if Error=0 then SetLine := true;
___ Blue Wave/QWK v2.12
--- Renegade v10-05 Exp

* Origin: Scrawled From the Tomb..(416-255-2164) (1:250/346)
SEEN-BY: 105/42 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 515 628 704 713/888 800/1 7877/2809
@PATH: 250/346 426 702 3615/50 396/1 270/101 105/103 42 712/515 711/808
@PATH: 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.