TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Peter Fitzsimmons
from: David Muir
date: 1995-08-09 18:56:12
subject: Serial I/O {4 of 10}

-=> Quoting Peter Fitzsimmons to David Muir <=-

 DM>          if TX_free>0 then doswrite(Fport,fchar,1,ret);

 PF> Calling DosWrite/Read for each byte is __very__ expensive.  You should
 PF> try and combine your ReadChar and ReadBlock (and WriteChar/WriteBlock)
 PF> so they use the same buffer (which is emptied by another thread
 PF> perhaps). 

    The Basic functions included in that unit were originally made to 
duplicate an existing "DOS" unit (for easy porting).

 PF> This is probably because of the write mode that the port is in.   I
 PF> did not see any ioctl call in your code to set the write mode (see
 PF> DCBINFO). 

    Agreed, but then the TESTCOMM program isn't exactly a "good"
example of a 
term program. It's more a sample of what someone can accomplish in 15 minutes.

 PF> If the write mode is "no wait" when your program starts,  the code
 PF> above will probably cause characters to be lost (you don't test to see
 PF> how many bytes were actually written).

    The problem with the "writeblock" (as in my unit) is more a matter of 
handling the fact that all characters sent out end up in the input buffer. And
my unit attempts to strip these characters so as not to display them locally. 
The writechar routine simply strips the character it sends, the writeblock 
could concievably receive a character at the same time thus making the 
"simple" stripping used by writechar ineffective.
    It was commented out more so that people would pay attention to how they 
used it rather than to discourage them from using it. The function itself 
looses no characters when implemented correctly.

    I have made numerous changes to the unit for my own purposes which are not
reflected in those routines, but thanks for the notes, I'll review them a 
little later to see if I skipped over anything useful... Thanks.

Dave...
___ 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™.