home *** CD-ROM | disk | FTP | other *** search
- {$U-,C-,R-,K-}
- Const
- MASTER_FILE_NAME = 'WXTERM.MST';
- Type
- MasterRec = record
- mdbits : 7..8;
- mparity : parity_set;
- mstop_bits : 1..2;
- mcom_port : com1..com2;
- mspeed : integer;
- mjropt : boolean;
- end;
- Var
- msrecord : MasterRec;
- msfile : file of MasterRec;
-
- procedure setup;
- {initialize most stuff - you may want to replace this routine completely}
-
- begin
- with msrecord do
- begin
- assign(msfile,MASTER_FILE_NAME);
- if exists(MASTER_FILE_NAME) then
- begin
- reset(msfile);
- read(msfile, msrecord)
- end
- else
- begin
- rewrite(msfile);
- mdbits := 7;
- mparity := EVEN;
- mstop_bits := 1;
- mcom_port := com1;
- mspeed := DEFAULT_BAUD;
- mjropt := false;
- write(msfile, msrecord);
- flush(msfile);
- end;
- dbits := mdbits;
- parity := mparity;
- stop_bits := mstop_bits;
- speed := mspeed;
- Cport := mcom_port;
- pcjrmode := mjropt;
- close(msfile);
- end;
- end;
-
-
- procedure GetParms;
- var
- p : string[4];
- yy: string[2];
- cp: string[5];
- begin
- writeln('Current Parameters:');
- writeln('Baud Rate:',speed:6);
- writeln('Data Bits:',dbits:6);
- writeln('Stop Bits:',stop_bits:6);
- case parity of
- even : p := 'EVEN';
- none : p := 'NONE';
- else p := '????'
- end;
- writeln('Parity: ',p:6);
- if Cport = com1 then cp := 'COM1'
- else cp := 'COM2';
- writeln('Comm Port: ',cp);
- writeln('PcJr Mode: ',pcjrmode);
- writeln;
- write('Change? (Y/N) ');
- readln(p);
- if length(p) > 0 then
- if upcase(p) = 'Y' then
- begin
- write('New Baud Rate (<cr> to keep): ');
- readln(speed);
- write('New Data Bits (<cr> to keep): ');
- readln(dbits);
- write('New Stop Bits (<cr> to keep): ');
- readln(stop_bits);
- write('New Parity (E or N or <cr> to keep): ');
- readln(p);
- write('New com port (1 or 2 or <cr> to keep: ');
- readln(cp);
- write('New PcJr mode (Y or N or <cr> to keep: ');
- readln(yy);
- if length(p) > 0 then
- case upcase(p) of
- 'E' : parity := even;
- else parity := none;
- end;
- if length(yy) > 0 then
- begin
- if upcase(yy) = 'Y' then
- pcjrmode := true
- else
- pcjrmode := false;
- end;
- if length(cp) > 0 then
- begin
- remove_port;
- if cp = '1' then
- Cport := com1;
- if cp = '2' then
- Cport := com2;
- init_port;
- term_ready(true);
- end;
- write('Save changes? (Enter Y if yes): ');
- readln(yy);
- if length(yy) > 0 then
- if upcase(yy) = 'Y' then
- begin
- with msrecord do
- begin
- mdbits := dbits;
- mparity := parity;
- mstop_bits := stop_bits;
- mspeed := speed;
- mcom_port := Cport;
- mjropt := pcjrmode;
- reset(msfile);
- write(msfile, msrecord);
- close(msfile);
- end;
- end;
- end
- end;
-
- procedure NewParms;
- begin
- OpenTemp(15,3,60,23,2);
- GetParms;
- CloseTemp;
- update_uart;
- New_Baud(speed)
- end;