home *** CD-ROM | disk | FTP | other *** search
/ Bila Vrana / BILA_VRANA.iso / 005A / 4UTILS85.ZIP / FIX.PAS < prev    next >
Pascal/Delphi Source File  |  1995-05-07  |  1KB  |  78 lines

  1. { This unit prevents TV from Resetting the screen mode at start up
  2.   thus allowing to work with resolutions like 100x40
  3.  
  4.  
  5.  
  6.  
  7.        __                   Robert Juhasz  | University of Paderborn
  8.         \_\                  Ludwigstr. 16 | Department of Maths & CS
  9.           __                4790 Paderborn | Fachbereich 17
  10.     _____ \ \                      Germany |
  11.    / /___)_\ \                             |
  12.   /_/ \_\ \___)   robertj@uni-paderborn.de |}
  13.  
  14.  
  15. unit Fix;
  16. interface
  17.  
  18. uses dos;
  19.  
  20. procedure InitFix;
  21. procedure DoneFix;
  22.  
  23. implementation
  24.  
  25. var
  26.   OldInt10,
  27.   OldExit  : Pointer;
  28.   VMode    : Byte absolute $0:$449;   { BIOS video mode }
  29.  
  30. const
  31.   Installed: Boolean = false;
  32.  
  33. procedure ChainInt(OldInt:Pointer);
  34. inline($5b/$58/
  35.        $89/$ec/
  36.        $87/$46/$10/
  37.        $87/$5e/$0e/
  38.        $5d/$07/$1f/
  39.        $5f/$5e/$5a/$59/
  40.        $cb);
  41.  
  42. procedure FixMode(ax,bx,cx,dx,si,di,ds,es,bp:Word);Interrupt;
  43. begin
  44.   if Hi(ax)=0 then ax:=Word( VMode );
  45.   ChainInt(OldInt10)
  46. end;
  47.  
  48. procedure InitFix;
  49. begin
  50.   if not Installed
  51.   then begin
  52.     Installed := true;
  53.     GetIntVec($10,OldInt10);
  54.     SetIntVec($10,@FixMode)
  55.   end
  56. end;
  57.  
  58. procedure DoneFix;
  59. begin
  60.   if Installed
  61.   then begin
  62.     Installed := false;
  63.     SetIntVec($10,OldInt10)
  64.   end
  65. end;
  66.  
  67. procedure AtExit; far;
  68. begin
  69.   ExitProc := OldExit;
  70.   DoneFix;
  71. end;
  72.  
  73. begin
  74.   OldExit  := ExitProc;
  75.   ExitProc := @AtExit;
  76.   InitFix;
  77. end.
  78.