| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Serial I/O {3 of 10} |
Function WriteChar(Var fchar : char) : Boolean;
{ Writes 'fchar' to the previously opened port. True if sent}
Function ReadChar(Var fchar : char) : Boolean;
{ Read a character from the port. Waits for input according to
Device Control Block 'read_tmo' before returning. Returns true
if a character is returned.}
Procedure ReadBlock( Var buf;
toread : longint;
Var numb_read : longint);
{ Reads 'toread' characters from the RX buffer into 'buf'
Sets 'numb_read' to the actual number of character read from RX }
(*
Procedure WriteBLOCK( Var buf;
Var towrite : longint;
Var numb_writ : longint);
Note that writeblock has been commented out because the method
used is EXTREMELY prone to inaccuracies and loss of characters.
Although this routine should word satifactorily if properly
implemented and LocalEcho is set to true.
Use "Writestring" instead.
If you find an effective way to implement this, please forward it to me.
*)
Procedure WriteString(to_write : string);
{ Writes a "string" of characters the the port. No carriage return is
assumed. If you require a carriage return append it to the string. }
Procedure HandleChar(tchar : char);
{ Handles characters which are recieved during 'WriteString' or
'WriteChar' This Procedure simply writes the character to
'output' and can be modified in any way that you wish to
handle characters which are received during an attempt to send.
This Procedure is ONLY used if LocalEcho is false }
Function Pending : Boolean;
{ Determines if output is pending in the outbound buffer. Used by
the 'write' routines to force characters immediately to the uart
if no outbound characters are present. }
Function FindOpenPort(Env_str : Pchar) : Boolean;
{ Use this _ONLY_ if OpenPort fails and _ONLY_ if you know that
you will be granted port access by the parent process.
ATTEMPTS to locate an open comport to which it has access.
NOTE THAT THIS IS NOT AN ACCURATE METHOD FOR DETERMINING THIS.
- If Env_str is defined by a number, this routine sets Fport
to that number with no further checks. Use in instances where
an environment variable is set by a parent process which points
to the 'HFILE' it has assigned to the comport.
- Otherwise the routine looks for a currently assigned 'HFILE'
with a baudrate in excess of 299 as well as having DCB flags
other than '0'. This method does not guarantee that the port is
correct or properly accessible. }
(***************************************************************************)
(* --------------------------- IMPLEMENTATION ---------------------------- *)
(***************************************************************************)
IMPLEMENTATION
Function Openport(Var Pname : Pchar) : Boolean;
VAR
action:longint;
BEGIN
EAptr := nil;
Action := 1;
Error := DosOpen
{filename} (pname,
{file handle} Fport,
{action} Action,
{file size} 0,
{attribute} 0,
{openflags} file_Open or Open_Action_Open_If_Exists,
{openmode} Open_Access_ReadWrite or Open_Share_DenyReadWrite or
Open_Flags_Fail_On_Error,
{EAs} EAptr);
Openport := (Error=0);
end;
Procedure sendcharnow(to_send:char);
VAR
tptr:pointer;
status:byte;
retlength:longint;
BEGIN
status := (ord(to_send));
tptr := {at}status;
DosDevIOCtl(Fport,1,$44,tptr,
sizeof(status),retlength,tptr,sizeof(status),retlength);
end;
Function WriteChar(Var fchar : char): Boolean;
VAR
e,ret:longint;
___ 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™.