[net.micro.pc] using COM1 from Turbo Pascal

wylie@cui.UUCP (WYLIE Andrew) (06/16/86)

Hello,
      I am trying to use the COM1 serial port on an IBM PC-AT from Turbo
Pascal, and I have a couple of problems. I would appreciate any comments
from experienced net.pc people - by e-mail please, not to the net unless
you really think the topic is interesting enough.

First problem - I use the function Keypressed to poll the keyboard. What
Borland dont tell you is that any Read/Write to any device will wreck
the Keypressed function. Try this program - run it and type any normal
alphanumeric key : the prog will tell you what it was. Now remove the
comments from the writeln and re-run it - you will have to type *two*
characters to have the second one echoed.

Program test;

VAR
   key: char;

begin
     while (not Keypressed) ;

     writeln('hello there');
     read(KBD,key);
     writeln('key hit was ',key);
end.

Second problem - using the COM1 port. I use the routines in COMLIB.PAS from
the Turbo Tutor disk, which make proper BIOS calls. First of all, any read
or write to the port wrecks Keypressed as above, but more seriously, the
SerialStatus function always returns with DSR = 0 (DataSetReady , which is
SerialStatus and $20). It *does* seem to work on an Olivetti XT clone, the
problem lies with the AT (I run DOS 3.0).
  Has anyone else experienced this problem ? Can it be fixed ? Can I use
the PORT[] array instead of COMLIB ? All suggestions (by e-mail) welcome !




-----------------------------------------------------------------------------
         Andrew Wylie
         Groupe NSI
         Uni II
         Universite de Geneve
         1211 GENEVE 4              (Switzerland)

         to VMS/BITNET:                    to UNIX/EAN 

BITNET:   WYLIE@CGEUGE51                    wylie%cui.unige.chunet@CERNVAX
ARPA:     WYLIE%CGEUGE51.BITNET@WISCVM      wylie%cui.unige.chunet@ubc.csnet
uucp:                                       mcvax!cernvax!cui!wylie   
X.400/ean:                                  wylie@cui.unige.chunet