home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / WXTERMSR.ZIP / WXTMDIAL.INC < prev    next >
Encoding:
Text File  |  1986-10-16  |  3.9 KB  |  141 lines

  1. {$U-,C-,R-,K-}
  2. Const
  3.      MASTER_FILE_NAME = 'WXTERM.MST';
  4. Type
  5.     MasterRec        = record
  6.                        mdbits      : 7..8;
  7.                        mparity     : parity_set;
  8.                        mstop_bits  : 1..2;
  9.                        mcom_port   : com1..com2;
  10.                        mspeed      : integer;
  11.                        mjropt      : boolean;
  12.                        end;
  13. Var
  14.    msrecord              : MasterRec;
  15.    msfile                : file of MasterRec;
  16.  
  17. procedure setup;
  18. {initialize most stuff - you may want to replace this routine completely}
  19.  
  20. begin
  21.   with msrecord do
  22.   begin
  23.      assign(msfile,MASTER_FILE_NAME);
  24.      if exists(MASTER_FILE_NAME) then
  25.      begin
  26.         reset(msfile);
  27.         read(msfile, msrecord)
  28.      end
  29.      else
  30.      begin
  31.         rewrite(msfile);
  32.         mdbits      := 7;
  33.         mparity     := EVEN;
  34.         mstop_bits  := 1;
  35.         mcom_port   := com1;
  36.         mspeed      := DEFAULT_BAUD;
  37.         mjropt      := false;
  38.         write(msfile, msrecord);
  39.         flush(msfile);
  40.      end;
  41.      dbits        := mdbits;
  42.      parity       := mparity;
  43.      stop_bits    := mstop_bits;
  44.      speed        := mspeed;
  45.      Cport        := mcom_port;
  46.      pcjrmode     := mjropt;
  47.      close(msfile);
  48.   end;
  49. end;
  50.  
  51.  
  52. procedure GetParms;
  53. var
  54.    p : string[4];
  55.    yy: string[2];
  56.    cp: string[5];
  57. begin
  58.      writeln('Current Parameters:');
  59.      writeln('Baud Rate:',speed:6);
  60.      writeln('Data Bits:',dbits:6);
  61.      writeln('Stop Bits:',stop_bits:6);
  62.      case parity of
  63.           even : p := 'EVEN';
  64.           none : p := 'NONE';
  65.           else   p := '????'
  66.      end;
  67.      writeln('Parity:   ',p:6);
  68.      if Cport = com1 then cp := 'COM1'
  69.      else                 cp := 'COM2';
  70.      writeln('Comm Port: ',cp);
  71.      writeln('PcJr Mode: ',pcjrmode);
  72.      writeln;
  73.      write('Change? (Y/N) ');
  74.      readln(p);
  75.      if length(p) > 0 then
  76.         if upcase(p) = 'Y' then
  77.         begin
  78.           write('New Baud Rate (<cr> to keep): ');
  79.           readln(speed);
  80.           write('New Data Bits (<cr> to keep): ');
  81.           readln(dbits);
  82.           write('New Stop Bits (<cr> to keep): ');
  83.           readln(stop_bits);
  84.           write('New Parity (E or N or <cr> to keep): ');
  85.           readln(p);
  86.           write('New com port (1 or 2 or <cr> to keep:  ');
  87.           readln(cp);
  88.           write('New PcJr mode (Y or N or <cr> to keep: ');
  89.           readln(yy);
  90.           if length(p) > 0 then
  91.              case upcase(p) of
  92.                'E' : parity := even;
  93.                else parity := none;
  94.              end;
  95.          if length(yy) > 0 then
  96.             begin
  97.                if upcase(yy) = 'Y' then
  98.                   pcjrmode := true
  99.                else
  100.                   pcjrmode := false;
  101.             end;
  102.          if length(cp) > 0 then
  103.             begin
  104.                remove_port;
  105.                if cp = '1' then
  106.                   Cport := com1;
  107.                if cp = '2' then
  108.                   Cport := com2;
  109.                init_port;
  110.                term_ready(true);
  111.             end;
  112.          write('Save changes?  (Enter Y if yes): ');
  113.          readln(yy);
  114.          if length(yy) > 0 then
  115.             if upcase(yy) = 'Y' then
  116.             begin
  117.                with msrecord do
  118.                begin
  119.                   mdbits        := dbits;
  120.                   mparity       := parity;
  121.                   mstop_bits    := stop_bits;
  122.                   mspeed        := speed;
  123.                   mcom_port     := Cport;
  124.                   mjropt        := pcjrmode;
  125.                   reset(msfile);
  126.                   write(msfile, msrecord);
  127.                   close(msfile);
  128.                end;
  129.             end;
  130.      end
  131. end;
  132.  
  133. procedure NewParms;
  134. begin
  135.      OpenTemp(15,3,60,23,2);
  136.      GetParms;
  137.      CloseTemp;
  138.      update_uart;
  139.      New_Baud(speed)
  140. end;
  141.