home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / progrmng / logopat.zoo / logopat.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1991-01-14  |  4.4 KB  |  145 lines

  1. program logopat;
  2.  
  3. {   LOGOPAT by Erich Neuwirth                                               }
  4. {   Changes IBM LOGO so that it can run on EGA, VGA and MCGA cards.         }
  5. {   It also removes a bug which only showed up on 386 machines.             }
  6. {   Just runb it will create LOGOVGA.COM, which VGA cards and 286 machines. }
  7.  
  8. {    Developed through some hints found on the Compuserve LOGOFORUM          }
  9.  
  10. {   (C) 1990 Erich Neuwirth                                                 }
  11. {    BITNET (EARN): A4422DAB@AWIUNI11                                        }
  12. {   INTERNET:      a4422dab@Helios.EDVZ.UniVie.AC.AT                        }
  13. {   Institute for Statistics and Computer Science                           }
  14. {   UNIVERSITY OF VIENNA, UNIVERSITAETSSTR. 5/9, A-1010 VIENNA, AUSTRIA     }
  15.  
  16. type string8 = string[8];
  17.  
  18. type registers = record
  19.                  ax,bx,cx,dx,bp,si,di,ds,es,flags : integer
  20.                  end;
  21.  
  22. const hexval : array[0..15] of char = ('0','1','2','3','4','5','6',
  23.              '7','8','9','A','B','C','D','E','F');
  24.  
  25.  
  26. const pat1 : array[1..4] of byte = ($E9,$00,$00,$90);
  27.  
  28.  
  29. const pat2 : array[1..12] of byte =
  30.       ($50,$B4,$12,$B3,$10,$CD,$10,$80,$FB,$10,$58,$74);
  31.  
  32.    var i : integer;
  33.    logofile, logoout : file of byte;
  34.    b,alo,ahi,slo,shi : byte;
  35.    size,size1,size2 : integer;
  36.    filnam : string8;
  37.  
  38. function exists(var filname:string8): boolean;
  39. var fil : file;
  40. begin
  41.      assign(fil,filname);
  42.      {$I-}
  43.      reset(fil);
  44.      {$I+}
  45.      if ioresult<>0 then exists:=false else exists:=true;
  46. end;
  47.  
  48. procedure getaddress;
  49. var      regvars:   registers;
  50.          segaddr, offset,
  51.          i : integer;
  52. begin
  53.      regvars.ax:=$1130;
  54.      regvars.bx:=$0300;
  55.      Intr($10,regvars);
  56.      segaddr:=regvars.es;
  57.      offset:=regvars.bp;
  58.      shi:=hi(segaddr);
  59.      slo:=lo(segaddr);
  60.      ahi:=hi(offset);
  61.      alo:=lo(offset);
  62.      write('BIOS fonttable at address ');
  63.      writeln(
  64.              hexval[shi div 16],
  65.              hexval[shi mod 16],
  66.              hexval[slo div 16],
  67.              hexval[slo mod 16],':',
  68.              hexval[ahi div 16],
  69.              hexval[ahi mod 16],
  70.              hexval[alo div 16],
  71.              hexval[alo mod 16]);
  72. end;
  73.  
  74.    begin
  75.    textcolor(7);
  76.    textbackground(0);
  77.    write('LOGOPAT ');
  78.    writeln('                                                (C) 1990 Erich Neuwirth');
  79.    writeln('changes LOGO.COM (IBM LOGO) und creates LOGOVGA.COM.');
  80.    writeln;
  81.    writeln('Should only be applied to LOGO.COM dated 10/1/1983');
  82.    writeln('with file length 59120 byte.');
  83.    writeln;
  84. writeln('The new program runs on machines with a 386');
  85. writeln('and with EGA or VGA.');
  86. writeln('The changes have to be applied separately ');
  87. writeln('for different EGA and VGA cards.');
  88. writeln('The new program will NOT run on machines with CGA.');
  89.    writeln;
  90.    filnam:='LOGO.COM';
  91. if (not exists(filnam)) then
  92.    begin
  93.       writeln('File LOGO.COM not available,');
  94.       writeln('therefore it cannot be changed.');
  95.       halt;
  96.    end;
  97.  
  98.    getaddress;
  99.    assign(logofile,'LOGO.COM');
  100.    assign(logoout,'LOGOVGA.COM');
  101.    reset(logofile);
  102.    rewrite(logoout);
  103.  
  104.    size:=filesize(logofile);
  105.    size1:=lo(size);
  106.    size2:=hi(size);
  107.    for i:=1 to $e6b do begin read(logofile,b); write(logoout,b) end;
  108.    read(logofile,b);
  109.    write(logoout,slo);
  110.    read(logofile,b);
  111.    write(logoout,shi);
  112.    for i:=1 to 3 do begin read(logofile,b); write(logoout,b) end;
  113.    read(logofile,b);
  114.    write(logoout,alo);
  115.    read(logofile,b);
  116.    write(logoout,ahi);
  117.    for i:=1 to ($794b-7-$e6b) do begin read(logofile,b); write(logoout,b) end;
  118.    for i:=1 to 4 do begin read(logofile,b); write(logoout,pat1[i]) end;
  119.    writeln('Adapted for 386.');
  120.  
  121.    for i:=1 to ($4c67 - $2af) do begin read(logofile,b); write(logoout,b) end;
  122.    read(logofile,b);
  123.    write(logoout,slo);
  124.    read(logofile,b);
  125.    write(logoout,shi);
  126.    for i:=1 to 12 do begin read(logofile,b); write(logoout,b) end;
  127.    read(logofile,b);
  128.    write(logoout,alo);
  129.    read(logofile,b);
  130.    write(logoout,ahi);
  131. {  for i:=1 to $4c67 do begin read(logofile,b); write(logoout,b) end;
  132. }
  133.    for i:=1 to ($2af-16) do begin read(logofile,b); write(logoout,b) end;
  134.    for i:=1 to 12 do begin read(logofile,b); write(logoout,pat2[i]) end;
  135.    writeln('Adapted for VGA.');
  136.  
  137.    for i:=1 to $212e do begin read(logofile,b); write(logoout,b) end;
  138.  
  139.  
  140.    close(logofile);
  141.    flush(logoout);
  142.    close(logoout);
  143.    writeln;
  144.    end.
  145.