{$M $4000,0,655360}
{$A+,E-,N-,D+,L+,O-   :Global}
{$B-,F-,I-,R-,S+,V-    :Local}
{
靈컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캠
�                                                                            �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴쩡쩡컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�   Supplied by: Scythale             � �    Written by: Vector Sigma        �
�    Cracked by: None                 � �    Protection: None                �
�   Packaged by: MoX                  � 쿒raphics/Sound: GUI                 �
�  Release Date: 16/12/94             � �  Program Type:                     �
�        Rating:                      � �    # of Disks:                     �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴좔좔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
�                                                                            �
�                                                                            �
�                                                                            �
�                                                                            �
�                                                                            �
픔컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캘
�                                                                            �
聃컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴캭
}
Unit Mouse_;
Interface
Const
 IntMouse = $33;

var
 nbut,stat:word;
 SourisAffichee : Boolean;
 GererSouris    : Boolean;

 Procedure Init_Mouse ( VAR result : boolean ); {test existence}
 procedure Mouse_Stat(var status,nbbout:word);  {type de souris}
 procedure Show_Mouse; {affiche la souris}
 procedure Hide_Mouse; {la cache}
 {procedure pos_and_butt(var x,y:integer;var butt:word);}
 Procedure Mouse_status ( Var So1, So2, So3 : Boolean;
                          Var XSo, YSo      : Integer  ); {renvoie sa position}
 Function ClipSouris( XSo, YSo,
                      X, Y,
                      LgX, LgY : Integer ) : Boolean; {posit souris,posit obj, taille et en retour, si on est dessus}
 procedure modif_pos(x,y:word); {on la bouge}
 procedure butt_clicked(button:word;
                      var status,
                      compt,
                      horz,
                      vert:word);
 procedure max_horz(min,max:word); {on la limite}
 procedure max_vert(min,max:word);
 procedure masks;
 procedure change_pointeur(size:word);



Implementation
uses graph,dos;

const
 masquecran : array[1..16] of word = ($c809,$b7f6,$affa,$d88d,$d88d,$d88d,$dffd,
                       $de3d,$ee3b,$f3e7,$f2a7,$eaab,$daad,$baae,$b2a6,$c809);
                       {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);}
 masquesouris:array[1..16] of word = ($FFFF,$FFFF,$FFFF,$FFFF,$FFFF,$FFFF,$FFFF,
                       $FFFF,$FFFF,$FFFF,$FFFF,$FFFF,$FFFF,$FFFF,$FFFF,$FFFF);

var
 x1,y1,x2,y2:integer;
 ends,texton:boolean;
 x,y:integer;
 butt:word;
 chh:char;
 regs:registers;
 ModeInf     : INTEGER;
 ModeSup     : INTEGER;

Procedure Init_Mouse ( VAR result : boolean );
Var
 R : Registers;
Begin
 R.AX := $0000;
 Intr(IntMouse,R);
 If R.AX<>$FFFF Then
  Begin
   Result:=false;
   SourisAffichee := False;
   GererSouris := False;
  end
 else
  begin
   Result:=true;
   SourisAffichee := False;
   GererSouris := True;
  end;
End;

procedure Mouse_Stat(var status,nbbout:word);
begin
 with regs do
  begin
   ax:=0;
   intr($33,regs);
   status:=ax;
   nbbout:=bx;
  end;
end;

procedure Show_Mouse;
begin
 If GererSouris Then
 with regs do
  begin
   ax:=1;
   intr($33,regs);
   SourisAffichee := True;
  end;
end;

procedure Hide_Mouse;
begin
If GererSouris Then
 with regs do
  begin
  ax:=2;
  intr($33,regs);
  SourisAffichee := False;
 end;
end;

Function ClipSouris( XSo, YSo,
                     X, Y,
                     LgX, LgY : Integer ) : Boolean;
Begin
 ClipSouris := (XSo>=X) And (XSo<=X+LgX-1) And
               (YSo>=Y) And (YSO<=Y+LgY-1) ;
End;

{procedure pos_and_butt(var x,y:integer;var butt:word);
begin
 with regs do
  begin
   ax:=3;
   intr($33,regs);
   x:=cx;
   y:=dx;
   butt:=bx;
  end;
end;}
Procedure Mouse_status ( Var So1, So2, So3 : Boolean;
                         Var XSo, YSo      : Integer  );
Var
 R : Registers;
Begin
 R.AX := $0003;
 Intr(IntMouse,R);
 So1 := (R.BX And 1)<>0;
 So2 := (R.BX And 4)<>0;
 So3 := (R.BX And 2)<>0;
 XSo := R.CX;
 YSo := R.DX;
End;

procedure modif_pos(x,y:word);
begin
 with regs do
  begin
   ax:=4;
   cx:=x;
   dx:=y;
   intr($33,regs);
  end;
end;

procedure butt_clicked(button:word;
                      var status,
                      compt,
                      horz,
                      vert:word);
begin
 with regs do
 begin
  ax:=5;
  bx:=button;
  intr($33,regs);
  status:=ax;
  compt:=bx;
  horz:=cx;
  vert:=dx;
 end;
end;

procedure max_horz(min,max:word);
begin
 with regs do
  begin
   ax:=07;
   cx:=min;
   dx:=max;
   intr($33,regs);;
   end;
end;

procedure max_vert(min,max:word);
begin
 with regs do
  begin
   ax:=08;
   cx:=min;
   dx:=max;
   intr($33,regs);
  end;
end;

procedure masks;assembler;
 asm
  MOV  CX,16h
  MOV  SI,offset masquecran
  MOV  DI,offset masquesouris
  PUSH DS
  POP  ES
  REP  MOVSW
  MOV  DI,offset masquesouris
  MOV  CX,16h
 @boucle: not WORD PTR[di]
  ADD  DI,2
  LOOP @boucle
  MOV  AH,09h
  mov dx,seg masquecran
  mov es,dx
  mov dx,offset masquecran
  mov cx,8h
  mov bx,8h
  mov ax,9h
  int 33h
  end;

procedure change_pointeur(size:word);
begin
 regs.ax:=$0a;
 regs.cx:=0;
 regs.cx:=size;
 intr($33,regs);
end;

begin
end.


