home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / FIBMCM.ZIP / FIBMCOMT.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-05-11  |  1.6 KB  |  55 lines

  1. program IBMCOMT;
  2.   (* Simple test program for COM_MGR, strictly similar to Wayne E. Conrad's
  3.   test program for his IBMCOM.  Acts like a dumb terminal at a fixed
  4.   speed and with no commands except for Esc to exit the program.  Obviously
  5.   it doesn't test all of COM_MGR, but it demonstrates the most important
  6.   calls. *)
  7.  
  8.   uses
  9.     CRT     (* ClrScr, KeyPressed, ReadKey *),
  10.     COM_MGR (* COM_CONFIGURATION, COM_INPUT_WAITING, COM_RAISE_DTR, COM_READ,
  11.                  COM_VERSION, COM_WRITE_CH, COM1, INIT_COM_MGR, NO_PARITY,
  12.                  ONE_STOP_BIT, TERM_COM_MGR *);
  13.   
  14.   const
  15.     ALTX = #45;
  16.   
  17.   var
  18.     ALTX_RECEIVED: boolean;
  19.     CH: char;
  20.   
  21.   begin (* IBMCOMT *)
  22.     with COM_CONFIGURATION do
  23.       begin (* tell COM_MGR how to start *)
  24.         FILED_VERSION := COM_VERSION;
  25.         NEED_DSR := true;
  26.         USING_DTR := true;
  27.         USING_XOFF := false;
  28.         THESE_DATA_BITS := 7;
  29.         THIS_BAUD := 2400;
  30.         THIS_PARITY := NO_PARITY;
  31.         THIS_PORT := COM1;
  32.         THESE_STOP_BITS := ONE_STOP_BIT
  33.       end   (* tell COM_MGR how to start *);
  34.     INIT_COM_MGR;
  35.     COM_RAISE_DTR;
  36.     ClrScr;
  37.     ALTX_RECEIVED := false;
  38.     
  39.     repeat (* process remote character *)
  40.       if KeyPressed then
  41.         begin (* might be extended *)
  42.           CH := ReadKey;
  43.           if CH <> #0 then
  44.             COM_WRITE_CH(CH)
  45.           else
  46.             ALTX_RECEIVED := (ReadKey = ALTX)
  47.         end   (* might be extended *);
  48.       
  49.       if COM_INPUT_WAITING > 0 then
  50.         write(COM_READ)
  51.     until  (* process remote character *) ALTX_RECEIVED;
  52.     
  53.     TERM_COM_MGR
  54.   end   (* IBMCOMT *).
  55.