home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.update.uu.se
/
ftp.update.uu.se.2014.03.zip
/
ftp.update.uu.se
/
pub
/
rainbow
/
msdos
/
latrobe
/
f
/
fixrb2.arc
/
FIXRB.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1987-11-22
|
4KB
|
119 lines
program FixRainbow(iosys,output);
{ This program patches IO.SYS on the DEC Rainbow. A bug in Rainbow MS-DOS
versions 2.05, 2.11, 2.11-1 and 3.10.17 prevents raw mode console output
from writing correctly. The symptom is that the first letter of any write
sequence is repeated for the length of the string. For example, instead
of writing "Dr. Pascal", a program would write "DDDDDDDDDDDD"
(two extra for CR LF). }
{ On MS-DOS 2.05 the problem is at 128F and 1290, on MS-DOS 2.11 it is at
14DA and 14DB, and on MS-DOS 3.10.17 at 1569 and 156A. In each case you
change 56 AC to AC 56. It is essential for the file be changed in-place
ala DEBUG, not copied and changed ala PATCH. }
{ This patch must be done before running Dr. Pascal ver 2.0 on the Rainbow.
It is also known to be required for FinalWord. It is not needed for
Dr. Pascal version 1.x }
{ This program was compiled by Prospero ProPascal version 3.1. It was much
easier to do in ProPascal than in "hobby" Pascal systems! }
{ Written by Willett Kempton, Visible Software. }
{ Revised 22 Nov 87 by WK to also patch MS-DOS 3.10.17 }
{$I DOSLIB.PAS ProPascal MS-DOS library }
type
Status = (unpatched, patched, unknown);
var
iosys: file of byte;
version: integer;
byte1,byte2: byte;
done: boolean;
procedure get2bytes(var b1,b2:byte);
begin
b1:= iosys^; get(iosys); b2:=iosys^;
end;
function category: status;
begin
category := unknown;
if (byte1=56H) and (byte2=0acH) then category:=unpatched
else if (byte1=0acH) and (byte2=56H) then category:=patched;
end;
procedure VerifyIf(ver:integer);
{ The location of 56 AC in IO.SYS leads us to expect DOS version "ver" }
begin
if (category <> unknown) and (version<>ver) then
writeln('Strange, this IO.SYS is for MS-DOS ',ver/100:3:2,
' ... I''ll attempt to patch it anyway.');
end;
procedure PutNewValues;
{ Do the patch }
begin
iosys^:=0acH; put(iosys);
iosys^:=56H; put(iosys);
writeln; writeln(' Fixed! ');
end;
procedure TryVersion(ver:integer;loc:integer;var done:boolean);
{ Verify version "ver" via the 56 AC bytes at location loc }
{ If it is the expected version, patch it or report if already patched. }
begin
done := true;
seek(iosys,loc);
get2bytes(byte1,byte2);
VerifyIf(ver);
case category of
unpatched:
begin seek(iosys,loc); PutNewValues; end;
patched:
begin writeln;writeln('This file has already been patched!'); end;
unknown: done := false;
end { case };
end { TryVersion };
begin { FixRainbow }
writeln;
writeln('This program fixes a bug in the DEC Rainbow 100 MS-DOS system.');
writeln('It must be run from each disk from which MS-DOS is booted up.');
writeln;
version:=VerNum;
writeln('You are now running MS-DOS version ',version/100:4:2);
writeln('Preparing to patch IO.SYS on drive ',GetDrive,':');
{ initial attributes of IO.SYS are [AttrReadOnly, AttrHidden, AttrSystem] }
SetFileAttr('\IO.SYS',[]); { allow modification of file }
fbuffer(iosys,4096); { big buffer, faster }
assign(iosys,'\IO.SYS');
update(iosys); { allow simultaneous reads and writes }
if eof(iosys)
then
begin
writeln;
writeln('ERROR: No file \IO.SYS on this drive.');
erase(iosys); { erase the empty created file }
end
else
begin
TryVersion(205,118fH,done); { 118fH = 128f in DEBUG }
if not done then
begin
TryVersion(211,13daH,done); { 13daH = 14daH in DEBUG }
if not done then
begin
TryVersion(310,1469H,done); { 1469H = 1569H in DEBUG }
if not done then
begin
writeln;
writeln('ERROR: Cannot identify this IO.SYS file.');
write('This program works only on DEC Rainbow MS-DOS');
writeln(' 2.05, 2.11, 2.11-1 and 3.10');
end;
end;
end { if not done };
close(iosys,true); { probably needed to write buffer prior to SetAttr }
SetFileAttr('\IO.SYS', [AttrReadOnly, AttrHidden, AttrSystem] );
end;
end {FixRainbow}.