program TermPrint(input,output); { ++++++++++++++++++++++++++++++++++++++++++++++++++ } { } { Display Terminal Setups for TURBO PASCAL Terminals } { Dump file requested : TINST.DTA } { } { ++++++++++++++++++++++++++++++++++++++++++++++++++ } {$V-} const DtaFile = 'TINST.DTA'; CtrlC = ^C; Dig = 3; type Any = string; Struc = array [1..24] of byte; stream = (single,multiple); DtaRec = record Name : string [20]; LeadIn : string [15]; LeadOut : string [15]; PosCurs : string [15]; XYmode : byte; Xpos : byte; Ypos : byte; Xoff : byte; Yoff : byte; XYdel : integer; Home : string [5]; Clr : string [5]; ClDel : integer; InvOn : string [5]; InvOff : string [5]; EOLDel : integer; EOLCl : string [5]; InsLin : string [5]; DelLin : string [5]; Col : byte; Lin : byte; Data : Struc; end; var FLen : integer; i : integer; Term : integer; Err : integer; Fin : file of DtaRec; procedure PrArray(msg:any; var ctr:Struc); var i : integer; x : byte; y : byte; procedure Nibble(n:byte); var nb : byte; begin nb:=n AND $0f; if nb>9 then nb:=nb+7; write(chr(nb+ord('0'))); end; procedure Dump(var b:byte); begin Nibble(b SHR 4); Nibble(b); write(' '); end; Begin { PrArray } write(' ':Dig,msg,' : '); x:=WhereX; y:=WhereY; for i:=1 to SizeOf(ctr) do begin Dump(ctr[i]); if (WhereX+6>=GetMaxX) then begin inc(y); GotoXY(x,y); end; end; writeln; End; procedure Decode(var msg:any); var i : integer; Begin for i:=1 to length(msg) do if msg[i] in [' '..'~'] then write(msg[i]) else write('^',chr(ord(msg[i])+ord('@'))); End; procedure Control(msg:any; var ctr:any); Begin write(' ':Dig,msg,' : '); if length(ctr)=0 then write ('NONE') else Decode(ctr); writeln; End; procedure PrWord(msg:any; ctr:integer); Begin writeln(' ':Dig,msg,' : ',ctr); End; procedure PrByte(msg:any; ctr:byte); Begin writeln(' ':Dig,msg,' : ',ctr); End; procedure TellName(flow:stream; num:integer); var c : char; FRec : DtaRec; Begin ClrScr; write(num:Dig); read(Fin,FRec); with FRec do begin write(' '); LowVideo; writeln('Terminal ',Name,':'); NormVideo; Control(' Lead In',LeadIn); Control(' Lead Out',LeadOut); Control(' Cursor setting',PosCurs); PrByte (' X-Y mode',XYmode); PrByte (' X position',Xpos); PrByte (' Y position',Ypos); PrByte (' X offset',Xoff); PrByte (' Y offset',Yoff); PrWord (' XY delay',XYdel); Control(' Home cursor',Home); Control(' Clear screen',Clr); PrWord (' Clear delay',ClDel); Control(' Invers on',InvOn); Control(' Invers off',InvOff); PrWord (' EOL delay',EOLDel); Control('Clear to end of line',EOLCl); Control(' Insert line',InsLin); Control(' Delete line',DelLin); PrByte (' Screen columns',Col); PrByte (' Screen lines',Lin); PrArray(' Remainder',Data); end; if flow=multiple then begin repeat until keypressed; read(kbd,c); if c=CtrlC then halt; end; End; BEGIN assign(Fin,DtaFile); if exist(Fin) then begin reset(Fin); FLen:=FileSize(Fin); if ParamCount=0 then for i:=1 to FLen do TellName(Multiple,i) else begin val(ParamStr(1),Term,Err); if (Term<=FLen) AND (Err=0) then begin Seek(Fin,pred(Term)); TellName(Single,Term); end else writeln('Invalid terminal selection'); end; end else writeln('Missing file ',DtaFile); END.