home *** CD-ROM | disk | FTP | other *** search
-
- { main file FULCOM.PAS}
- { IBM and TI compatible comm port procedures}
-
- {
- This is a dumb-terminal program to test the two include files FULCOM.IBM
- and FULCOM.TIP. These include files contain a set of procedures and
- functions that are identical to the programmer, but operate the different
- hardware on the Texas Instruments Professional Computer and the IBM PC/XT.
- This enables a programmer to program a application program for either
- computer by including the appropriate file.
-
- The program features both input and OUTPUT buffering, handy when you are
- using the comm ports to drive a terminal or other device in a applications
- type of program.
-
-
- Enter the appropiate port parameters in the marked statement. To exit this
- program, press the "ESC" key. To toggle the state of the DTR line, press
- the "!" key.
- }
-
-
- program FULCOM;
-
- type WorkLineType=string[255];
-
- var Loop:boolean;
- TempString:WorkLineType;
- InChar:char;
- OldCTSStatus:boolean;
- OldDCDStatus:boolean;
- DTRStatus:boolean;
- ComPort:byte;
- RegisterSet:record case integer of
- 1: (AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags:integer);
- 2: (AL,AH,BL,BH,CL,CH,DL,DH:byte);
- end;
- DSstorage:integer absolute CSeg:$00A0;
-
- (************* comment out the appropiate include file ****************)
- (*{$IFULCOM.TIP}*)
- {$IFULCOM.IBM}
- (************************************************************************)
-
- begin
- DSStorage:=dseg;
- (******* place the port parameters here ***
- * ComPort= port number (1 or 2) *
- * Baud (300,1200,2400,4800,9600) *
- * Parity (E=even O=Odd N=none) *
- * WordSize (7 or 8) *
- * StopBits (1 or 2) *
- ********************************************)
- ComPort:=1;
- INITCOM(ComPort,1200,'O',7,1);
- (***************************************************)
- Loop:=true;
- OldCTSStatus:=false;
- OldDCDStatus:=false;
- DTRStatus:=true;
- clrscr;
- while Loop do begin
- if CTSStatus(ComPort)<>OldCTSStatus then begin
- OldCTSStatus:=CTSSTATUS(ComPort);
- write(#7' CTS STATUS CHANGE (',OldCTSStatus,') ');
- end;
- if DCDStatus(ComPort)<>OldDCDStatus then begin
- OldDCDStatus:=DCDSTATUS(ComPort);
- write(#7' DCD STATUS CHANGE (',OldDCDStatus,') ');
- end;
- if not(BUFFEREMPTY(InputBuffer[ComPort])) then begin
- InChar:=chr(READBUFFER(InputBuffer[ComPort]));
- write(InChar);
- end;
- if keypressed then begin
- read(kbd,InChar);
- case Inchar of
- #27:Loop:=false;
- '!':begin
- DTRStatus:=not(DTRStatus);
- TXControl(ComPort,DTRStatus);
- end;
- else begin
- TempString:=InChar;
- SENDSTRING(ComPort,TempString);
- end;
- end;
- end;
- end;
- TERMINATECOM(ComPort);
- end.