home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / mouse / mouse0 / mousunit.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1994-04-30  |  16.6 KB  |  596 lines

  1. {$N-}
  2. Unit Mousunit;
  3. {
  4. ***********************************************************
  5. *                                                         *
  6. *          Microsoft Mouse Interface Routines             *
  7. *                  Unit version  1.0                      *
  8. *                                                         *
  9. *                  Copyright (C) 1988 by                  *
  10. *                    Dr. Bernhard Stütz                   *
  11. *                                                         *
  12. ***********************************************************
  13. }
  14.  
  15. interface
  16. uses crt,dos,graph;
  17. type
  18.   MouseMenuFlags = Array [1..20] of boolean;
  19.   MaskType = Array [0..1,0..15] of word;
  20.   MaskPointer = ^MaskRecord;
  21.   MaskRecord = Record
  22.                  mask : masktype;
  23.                  x    : word;
  24.                  y    : word;
  25.                end;
  26. var
  27.   RightarrowCursor,DownarrowCursor,InvertedCursor:MaskRecord;
  28. const
  29.   LeftB:byte=0;
  30.   RightB:byte=1;
  31.  
  32.   StandardCursor : MaskRecord
  33.        = (mask:(($3fff,$1fff,$fff, $7ff, $3ff, $1ff, $ff,  $7f,
  34.                  $3f,  $1f,  $1ff, $10ff,$30ff,$f87f,$f87f,$fc3f),
  35.                 ($0,   $4000,$6000,$7000,$7800,$7c00,$7e00,$7f00,
  36.                  $7f80,$7fc0,$7c00,$4600,$600, $300, $300, $180));
  37.                 x:0;y:0);
  38.  
  39.   UpArrowCursor : MaskRecord
  40.        = (mask:(($f9ff,$f0ff,$e07f,$e07f,$c03f,$c03f,$801f,$801f,
  41.                  $f,   $f,   $f0ff,$f0ff,$f0ff,$f0ff,$f0ff,$f0ff),
  42.                 ($0,   $600, $f00, $f00, $1f80,$1f80,$3fc0,$3fc0,
  43.                  $7fe0,$600, $600, $600, $600, $600, $600, $600));
  44.                 x:5;y:0);
  45.  
  46.   LeftArrowCursor : MaskRecord
  47.        = (mask:(($fe1f,$f01f,$0,   $0,   $0,   $f01f,$fe1f,$ffff,
  48.                  $ffff,$ffff,$ffff,$ffff,$ffff,$ffff,$ffff,$ffff),
  49.                 ($0,   $c0,  $7c0, $7ffe,$7c0, $c0,  $0,   $0,
  50.                  $0,   $0,   $0,   $0,   $0,   $0,   $0,   $0));
  51.                 x:0;y:3);
  52.  
  53.   CheckMarkCursor : MaskRecord
  54.        = (mask:(($fff0,$ffe0,$ffc0,$ff81,$ff03,$607, $f,   $1f,
  55.                  $c03f,$f07f,$ffff,$ffff,$ffff,$ffff,$ffff,$ffff),
  56.                 ($0,   $6,   $c,   $18,  $30,  $60,  $70c0,$1d80,
  57.                  $700, $0,   $0,   $0,   $0,   $0,   $0,   $0));
  58.                 x:6;y:7);
  59.  
  60.   PointingHandCursor : MaskRecord
  61.        = (mask:(($e1ff,$e1ff,$e1ff,$e1ff,$e1ff,$e000,$e000,$e000,
  62.                  $0,   $0,   $0,   $0,   $0,   $0,   $0,   $0),
  63.                 ($1e00,$1200,$1200,$1200,$1200,$13ff,$1249,$1249,
  64.                  $f249,$9001,$9001,$9001,$8001,$8001,$8001,$ffff));
  65.                 x:5;y:0);
  66.  
  67.   DiagonalcrossCursor : MaskRecord
  68.        = (mask:(($7e0, $180, $0,   $c003,$f00f,$c003,$0,   $180,
  69.                  $7e0, $ffff,$ffff,$ffff,$ffff,$ffff,$ffff,$ffff),
  70.                 ($0,   $700e,$1c38,$660, $3c0, $660, $1c38,$700e,
  71.                  $0,   $0,   $0,   $0,   $0,   $0,   $0,   $0));
  72.                 x:7;y:4);
  73.  
  74.   RectangularCrossCursor : MaskRecord
  75.        = (mask:(($fc3f,$fc3f,$fc3f,$0,$0,   $0,   $fc3f,$fc3f,
  76.                  $fc3f,$ffff,$ffff,$ffff,$ffff,$ffff,$ffff,$ffff),
  77.                 ($0,   $180, $180, $180, $7ffe,$180, $180, $180,
  78.                  $0,   $0,   $0,   $0,   $0,   $0,   $0,   $0));
  79.                 x:7;y:4);
  80.  
  81.   HourglassCursor : MaskRecord
  82.        = (mask:(($0,   $0,   $0,   $0,   $8001,$c003,$e007,$f00f,
  83.                  $e007,$c003,$8001,$0,   $0,   $0,   $0,   $ffff),
  84.                 ($0,   $7ffe,$6006,$300c,$1818,$c30, $660, $3c0,
  85.                  $660, $c30, $1998,$33cc,$67e6,$7ffe,$0,   $0));
  86.                 x:7;y:7);
  87.  
  88. procedure ResetMouse;
  89. procedure ShowMouse;
  90. procedure HideMouse;
  91. procedure MousePos(var X,Y : word);
  92. function  LeftButton : Boolean;
  93. function  RightButton : Boolean;
  94. procedure PutMouse(X,Y : word);
  95. function  ButtonPressInfo(Button : byte;
  96.                           var PressCount,X,Y : word):boolean;
  97. function  ButtonReleaseInfo(Button : word;
  98.                             var PressCount,X,Y : word):boolean;
  99. procedure SetHorizontalRange(Min,Max : word);
  100. procedure SetVerticalRange(Min,Max : word);
  101. function  MouseInBox(x1,y1,x2,y2:word) : Boolean;
  102. procedure SetGraphicsCursor(var maskp : MaskRecord);
  103. procedure SetTextCursor(sel,start,stop : word);
  104. procedure MouseRatio(X,Y : Word);
  105. procedure MotionCounters(var X,Y : Integer);
  106. procedure LightPenEmulation(f : Boolean);
  107. procedure ConditionalOff(ux,uy,lx,ly : word);
  108. procedure DoubleSpeedThreshold(mickey : word);
  109. procedure SetMouseProcedure(m:word;p:pointer);
  110. Procedure CursorMirror(var S,D:MaskRecord;F:byte);
  111. Function  MouseMenu(s:string;c:byte;var f:MouseMenuFlags):byte;
  112.  
  113. (**************************************************************)
  114.  
  115. Implementation
  116.  
  117. var
  118.   CrtMode : byte absolute $40:$49;
  119.   MouseHandler : Pointer;
  120.   ExitSave : Pointer;
  121.   Int1BSave : Pointer;
  122.   OldCursor : Pointer;
  123.  
  124. const
  125.   M1 : word = 0;
  126.   M2 : word = 0;
  127.   M3 : word = 0;
  128.   M4 : word = 0;
  129.   M5 : word = 0;
  130.   M6 : word = 0;
  131.   MaxX : Integer = 639;   { EGA F-Mode }
  132.   MaxY : Integer = 349;   {      "     }
  133.   SegPointer : word = $ffff;
  134.   GDriver : integer = Detect;
  135.   GMode : integer = 0;
  136.   AboFlag : Boolean = false;
  137.   Hercules : Boolean = false;
  138.  
  139. function BitSet(TestByte : Byte; BitNumber : Byte) : Boolean;
  140. { Testet Bit BitNumber in Byte TestByte }
  141. begin
  142.   TestByte := TestByte and (1 shl  BitNumber);
  143.   BitSet := (TestByte > 0);
  144. end;
  145.  
  146. procedure CheckPos(var X, Y  : word);
  147. { Limitiert die Variablen X,Y auf die maximale Bildschirmgröße }
  148. begin
  149.   if Y > MaxY then Y := MaxY;
  150.   if X > MaxX then X := MaxX;
  151. end;
  152.  
  153. procedure Mouse;
  154. { Ruft den Maustreiber über Interrupt 51d }
  155. var
  156.   regs: registers;
  157. begin
  158.   Regs.ax := M1;    { CPU-Register für Mauscall setzen }
  159.   Regs.bx := M2;
  160.   Regs.cx := M3;
  161.   Regs.dx := M4;
  162.   Regs.si := M5;
  163.   Regs.di := M6;
  164.   Regs.es :=SegPointer;
  165.   Intr(51,Regs);    { Maustreiber aufrufen }
  166.   M1 := Regs.ax;    { Ergebnisse in Variablen kopieren }
  167.   M2 := Regs.bx;
  168.   M3 := Regs.cx;
  169.   M4 := Regs.dx;
  170. end;
  171.  
  172.  
  173. procedure ShowMouse;
  174. { Schaltet Mauszeiger ein }
  175. begin
  176.   M1 := 1;
  177.   Mouse;
  178. end;
  179.  
  180. procedure HideMouse;
  181. { Schaltet Mauszeiger aus }
  182. begin
  183.   M1 := 2;
  184.   Mouse;
  185. end;
  186.  
  187. procedure MousePos(var X,Y : word);
  188. { Ermittelt Position des Mauszeigers }
  189. begin
  190.   M1 := 3;
  191.   Mouse;
  192.   X := M3;
  193.   Y := M4;
  194.   if AboFlag then begin
  195.     CloseGraph;
  196.     NoSound;
  197.     writeln('Break');
  198.     halt(1);
  199.   end;
  200. end;
  201.  
  202. function LeftButton : Boolean;
  203. { Testet Status des linken Mausknopfs }
  204. begin
  205.   M1 := 3;
  206.   Mouse;
  207.   if BitSet(M2,LeftB) then LeftButton := true
  208.      else LeftButton := false;
  209. end;
  210.  
  211. function RightButton : Boolean;
  212. { Testet Status des rechten Mausknopfs }
  213. begin
  214.   M1 := 3;
  215.   Mouse;
  216.   if BitSet(M2,RightB) then RightButton := true
  217.      else RightButton := false;
  218. end;
  219.  
  220. procedure PutMouse(X,Y : word);
  221. { Setzt Mauszeiger auf bestimmte Position }
  222. begin
  223.   CheckPos(X,Y);
  224.   M1 := 4;
  225.   M3 := X;
  226.   M4 := Y;
  227.   Mouse;
  228. end;
  229.  
  230. Function ButtonPressInfo(Button : byte;
  231.                          var PressCount,X,Y : word):boolean;
  232. { Testet Anzahl der Mausknopfbetätigungen seit letztem Aufruf }
  233. { Button:    0=leftb, 1=rightb }
  234. begin
  235.   M1 := 5;
  236.   M2 := Button;
  237.   Mouse;
  238.   ButtonPressInfo:=BitSet(M1,Button);
  239.   PressCount := M2;   { Knopfbetätigungen seit letztem Aufruf}
  240.   X := M3;            { Cursor-Position bei letzter Betätigung}
  241.   Y := M4;            {            "                          }
  242. end;
  243.  
  244. Function ButtonReleaseInfo(Button : word;
  245.                            var PressCount,X,Y : word):boolean;
  246. { Testet Anzahl der Mausknopfloslassungen seit letztem Aufruf }
  247. { Button:    0=leftb, 1=rightb }
  248. begin
  249.   M1 := 6;
  250.   M2 := Button;
  251.   Mouse;
  252.   ButtonReleaseInfo := not BitSet(M1,Button);
  253.   PressCount := M2;   { Loslassungen seit letztem Aufruf}
  254.   X := M3;            { Cursor-Position bei letztem Loslassen}
  255.   Y := M4;            {            "                         }
  256. end;
  257.  
  258. procedure SetHorizontalRange(Min,Max : word);
  259. { setzt horizontalen Mauszeigerbereich }
  260. var Dummy:word;
  261. begin
  262.   CheckPos(Min,Dummy);
  263.   CheckPos(Max,Dummy);
  264.   M1 := 7;
  265.   M3 := Min;
  266.   M4 := Max;
  267.   Mouse;
  268. end;
  269.  
  270. procedure SetVerticalRange(Min,Max : word);
  271. { setzt vertikalen Mauszeigerbereich }
  272. var Dummy:word;
  273. begin
  274.   CheckPos(Dummy,Min);
  275.   CheckPos(Dummy,Max);
  276.   M1 := 8;
  277.   M3 := Min;
  278.   M4 := Max;
  279.   Mouse;
  280. end;
  281.  
  282. function MouseInBox(x1,y1,x2,y2:word) : Boolean;
  283. { Testet, ob sich Mauszeiger in bestimmten Bildschirmbereich befindet }
  284. var x,y:word;
  285. begin
  286.   if x2<x1 then begin x:=x1; x1:=x2; x2:=x; end;
  287.   if y2<y1 then begin y:=y1; y1:=y2; y2:=y; end;
  288.   MousePos(x,y);
  289.   MouseInBox:=( ((x>=x1) and (x<=x2-1))  and
  290.         ((y>=y1) and (y<=y2-1))  );
  291. end;
  292.  
  293. procedure SetGraphicsCursor(var maskp : MaskRecord);
  294. { Setzt neue Form des Grafik-Mauszeigers }
  295. begin
  296.   if OldCursor <> @maskp then begin
  297.     OldCursor := @maskp;
  298.     with Maskp do begin
  299.       M1 := 9;
  300.       M2 := X;
  301.       M3 := Y;
  302.       M4 := ofs(Mask);
  303.       SegPointer := seg(Mask);
  304.     end;
  305.   end;
  306.   Mouse;
  307. end;
  308.  
  309. procedure SetTextCursor(sel,start,stop : word);
  310. { setzt Größe und Art des Mauszeigers im Textmodus }
  311. begin
  312.   M1 := 10;
  313.   M2 := sel;   { Hardware- oder Software-Cursor }
  314.   M3 := start; { Scanline oder Bildschirmmaske  }
  315.   M4 := stop;  { Scanline oder Zeigermaske      }
  316.   Mouse;
  317. end;
  318.  
  319. procedure MouseRatio(X,Y : Word);
  320. { Setzt Empfindlichkeit des Mauszeigers }
  321. begin
  322.   M1 := 15;
  323.   M3 := X;
  324.   M4 := Y;
  325.   Mouse;
  326. end;
  327.  
  328. procedure MotionCounters(var X,Y : Integer);
  329. { Gibt Distanz in Maus-Einheiten seit letztem Aufruf zurück }
  330. { 1 Mickey = 1/200 inch }
  331. var
  332.   x1,y1:longint;
  333. begin
  334.   M1:=11;
  335.   Mouse;
  336.   if M3 > $fff then x1:=m3-65536 else x1:=m3;
  337.   if M4 > $fff then y1:=m4-65536 else y1:=m4;
  338.   X:=x1;
  339.   Y:=y1;
  340. end;
  341.  
  342. procedure LightPenEmulation(f : Boolean);
  343. { Schaltet Light Pen Emulation an/aus }
  344. { Nur zur Vollständigkeit implementiert }
  345. begin
  346.   if f then M1:=13 else M1:=14;
  347.   Mouse;
  348. end;
  349.  
  350. procedure ConditionalOff(ux,uy,lx,ly : word);
  351. { Schaltet Mauszeiger aus, wenn er sich im angegeben Bereich befindet }
  352. begin
  353.   M1:=16;
  354.   if ux < lx then begin
  355.     M3:=ux;
  356.     M5:=lx;
  357.   end else begin
  358.     M3:=lx;
  359.     M5:=ux;
  360.   end;
  361.   if uy < ly then begin
  362.     M4:=uy;
  363.     M6:=ly;
  364.   end else begin
  365.     M4:=ly;
  366.     M6:=uy;
  367.   end;
  368.   Mouse;
  369. end;
  370.  
  371. procedure DoubleSpeedThreshold(mickey : word);
  372. { Legt Mausgeschwindigkeit fest, bei der sich
  373.   Mausempfindlichkeit verdoppelt }
  374. begin
  375.   M1:=19;
  376.   M4:=mickey;     { Schwelle in Mickeys/Sekunde }
  377.   Mouse;
  378. end;
  379.  
  380. procedure MouseCallExit;
  381. { Exit-Prozedur des Maustreiber-Aufrufs }
  382. { Nötig, weil Interrupt Procedure mit RETI statt mit RET FAR
  383.   beendet wird. Maustreiber erwartet RET FAR. }
  384. begin
  385.   Inline ($5D/$58/$58/$89/$EC/$5D/$07/$1F/
  386.           $5F/$5E/$5A/$59/$5B/$58/$CB);
  387.   { pop bp ; pop ax ; pop ax ; mov sp,bp ; pop es ; pop ds ;
  388.     pop di ; pop si ; pop dx ; pop cx ; pop bx ; pop ax ;
  389.     ret far}
  390. end;
  391.  
  392. Procedure UserHandlerCall(Mask,Button,X,Y:word);
  393. { Ruft User Maus Interrupt Prozedur }
  394. { Nötig, weil Turbo Pascal V4 keine prozeduralen Parameter erlaubt. }
  395.   Inline($FF/$1E/MouseHandler);  { call far [MouseHandler] }
  396.  
  397. Procedure MouseInterrupt(Flags,CS,IP,AX,BX,CX,DX,SI,DI,DS,ES,BP:word);
  398. { Diese Prozedur wird vom Maustreiber bei in Mask festgelegten
  399.   Bedingungen gerufen. Von ihr wird der User Handler gerufen. }
  400. Interrupt;
  401. Begin
  402.   UserHandlerCall(AX,BX,CX,DX);
  403.   MouseCallExit;
  404. End;
  405.  
  406. procedure SetMouseProcedure(m:word;p:pointer);
  407. { Teilt Maustreiber Addresse von MouseInterrupt und Event-Maske mit }
  408. begin
  409.   M1:=12;
  410.   M3:=m;
  411.   M4:=Ofs(MouseInterrupt);
  412.   SegPointer:=Seg(MouseInterrupt);
  413.   MouseHandler:=p;   { Adresse des User Handlers }
  414.   Mouse;
  415. end;
  416.  
  417. Function MouseMenu(s:string;c:byte;var f:MouseMenuFlags):byte;
  418. { Menüzeile am unteren Bildrand einschalten, angeklickte
  419.   Auswahl als Funktionswert zurückgeben, Flags ändern }
  420. var
  421.   test,d:boolean;
  422.   color,ncolor,i,k,p1,p2,p3:byte;
  423.   boxl,count,x,y,y1:word;
  424.   code:integer;
  425.   text:string;
  426.   wbar:string;
  427. begin
  428.   SetViewPort(0,0,GetMaxX,GetMaxY,ClipOn);
  429.   if Length(s) > 0 then d:=true else d:=false;
  430.   p1:=1;
  431.   boxl:=trunc(GetMaxX/c);
  432.   MouseMenu:=0;
  433.   MousePos(x,y);
  434.   if y > GetMAxY-25 then begin
  435.     test:=buttonpressinfo(LeftB,count,x,y1);
  436.     setgraphicscursor(PointinghandCursor);
  437.   end;
  438.   while (y > GetMaxY-25) or d do begin
  439.     test:=buttonpressinfo(LeftB,count,x,y1);
  440.     ShowMouse;
  441.     if (count > 0) or d then begin
  442.       HideMouse;
  443.       if d then begin
  444.         SetViewPort(0,GetMaxY-25,GetMaxX,GetMaxY,ClipOn);
  445.         ClearViewPort;
  446.         SetViewPort(0,0,GetMaxX,GetMaxY,ClipOn);
  447.       end;
  448.       for i:=1 to c do begin
  449.         if MouseInBox(boxl*(i-1),GetMaxY-20,boxl*i-5,GetMaxY)
  450.                  and (count > 0) then begin
  451.           MouseMenu:=i;     { Funktionswert zurückgeben }
  452.           f[i]:=not f[i];   { zugehöriges Flag komplementieren }
  453.           Sound(440);       { akustische Rückmeldung }
  454.           delay(2);
  455.           NoSound;
  456.           MousePos(x,y);
  457.           SetViewPort(0,0,GetMaxX,GetMaxY-25,ClipOn);
  458.           exit;
  459.         end;
  460.         if d then begin
  461.           color:=GetColor;  { Menüleiste zeichnen }
  462.           SetColor(GetMaxColor);
  463.           Rectangle(boxl*(i-1),GetMaxY-20,boxl*i-5,GetMaxY);
  464.           if f[i] then begin
  465.             p1:=pos(':',copy(s,p1,length(s)))+p1;
  466.             p2:=pos(';',copy(s,p1,length(s)));
  467.             p3:=p2;
  468.           end else begin
  469.             p2:=pos(':',copy(s,p1,length(s)));
  470.             p3:=pos(';',copy(s,p1,length(s)));
  471.           end;
  472.           if p2 = 0 then p2:=length(s);
  473.           text:=copy(s,p1,p2-1);
  474.           val(copy(text,1,2),ncolor,code);
  475.           if copy(text,1,2) = '00' then begin
  476.             SetColor(GetMaxColor);
  477.             text:=copy(text,3,length(text));
  478.             wbar:='';
  479.             for k:=1 to length(text)+1 do wbar:=wbar+'█';
  480.             OutTextXY(boxl*(i-1)+3,GetMaxY-10,wbar);
  481.             SetColor(0);
  482.           end;
  483.           if ncolor > 0 then begin
  484.             if ncolor > GetMaxColor then ncolor := GetMaxColor;
  485.             SetColor(ncolor);
  486.             text:=copy(text,3,length(text));
  487.           end;
  488.           p1:=p3+p1;
  489.           OutTextXY(boxl*(i-1)+5,GetMaxY-10,text);
  490.           SetColor(color);
  491.         end;
  492.       end;
  493.       ShowMouse;
  494.     end;
  495.     MousePos(x,y);
  496.     d:=false;
  497.   end;
  498.   SetViewPort(0,0,GetMaxX,GetMaxY-25,ClipOn);
  499. end;
  500.  
  501. function BitInvert(b:word):word;
  502. { Inveriert Bitfolge in wort b : fedcba9876543210 -> 0123456789abcdef }
  503.  
  504. inline ($58/$B9/$10/$00/$33/$DB/$D1/$D0/$D1/$DB/$E2/$FA/$8B/$C3);
  505. { pop ax; mov cx,16; xor bx,bx; rcl ax,1; rcr bx,1;loop; mov ax,bx }
  506.  
  507. Procedure CursorMirror(var S,D:MaskRecord;F:byte);
  508. { Kopiert und spiegelt Mauszeiger-Masken }
  509. Var
  510.   i,k:byte;
  511. Begin
  512.   for i:= 0 to 1 do begin
  513.     for k:= 0 to 15 do begin
  514.       if (F and 1) > 0 then D.mask[i,k]:=S.mask[i,15-k]
  515.                        else D.mask[i,k]:=S.mask[i,k];
  516.       if (F and 2) > 0 then D.mask[i,k]:=BitInvert(D.mask[i,k]);
  517.     end;
  518.   end;
  519.   if (F and 1) > 0 then D.y:=15-S.y else D.y:=S.y;
  520.   if (F and 2) > 0 then D.x:=15-S.x else D.x:=S.x;
  521. end;
  522.  
  523. procedure ResetMouse;
  524. { Initialisiert Maustreiber, testet Bildschirmmodus, setzt bei
  525.   Herkuleskarte richtigen Bildschirmmodus und ermittelt maximalen
  526.   Mauszeigerbereich }
  527. var
  528.   size:word;
  529.   save:boolean;
  530. begin
  531.   DetectGraph(GDriver,Gmode);
  532.  
  533. { Mit diesem Trick versteht der Maustreiber die Herkuleskarte }
  534.  
  535.   if GDriver = HercMono then begin
  536.     CrtMode := 6;
  537.     Hercules := true;
  538.   end;
  539.  
  540.   M1 := 0;
  541.   Mouse;
  542.   MaxX:=GetMaxX;
  543.   MaxY:=GetMaxY;
  544.   SetHorizontalRange(0,MaxX);
  545.   SetVerticalRange(0,Maxy);
  546. end;
  547.  
  548. Procedure CallOld1B;
  549.   Inline ($9C/$FF/$1E/Int1BSave);
  550.   { pushf ; call far Int1BSave }
  551.   { rufe alten Interrupt 1B Handler }
  552.  
  553. {$F+} Procedure Int1B; Interrupt; {$F-}
  554. { Setzt Abbruch-Flag, wenn Break gedrückt wird.
  555.   Der Abbruch erfolgt, sobald MousePos aufgerufen wird }
  556. Begin
  557.   SetIntVec($1B,Int1BSave);
  558.   CallOld1B;
  559.   AboFlag:=true;
  560. End;
  561.  
  562. {$F+} Procedure MouseExit; {$F-}
  563. { Mouse Unit Exit Handler }
  564. { Setzt Bildschirmmodus auf Text Modus }
  565. Begin
  566.   M1 := 0;
  567.   Mouse;
  568.   nosound;
  569.   If Hercules then CrtMode := 7;
  570.   ExitProc:=ExitSave;
  571. end;
  572.  
  573. { Unit-Initialisierung }
  574. begin
  575.   M1 := 0;
  576.   Mouse;
  577.   if not (M1=65535) then begin {Testen, ob Maustreiber vorhanden}
  578.     CloseGraph;
  579.     ClrScr;
  580.     GotoXY(20,12);
  581.     Write('MS Maustreiber nicht installiert !');
  582.     Halt(1);
  583.   end;
  584.   MaxX:=79;
  585.   MaxY:=24;
  586.   ClrScr;
  587.  
  588.   CursorMirror(LeftArrowCursor,RightArrowCursor,2);
  589.   CursorMirror(UpArrowCursor,DownArrowCursor,1);
  590.   CursorMirror(StandardCursor,InvertedCursor,3);
  591.   ExitSave:=ExitProc;
  592.   ExitProc:=@MouseExit;
  593.   GetIntVec($1B,Int1BSave);
  594.   SetIntVec($1B,@Int1B);
  595. end.
  596.