gt3070b@prism.gatech.EDU (Jeff Watkins) (05/30/90)
unit mouse; interface uses dos,crt,desktop; function ReadMx:integer; function ReadMy:integer; function Mx:integer; function My:integer; function Click1:boolean; Function Click2:boolean; function click3:boolean; function but1:boolean; function but2:boolean; function but3:boolean; procedure PMouse(var m1,m2,m3,m4:word); procedure InitM; procedure InitGM; procedure Hidem; procedure Showm; Procedure StoreClick(C:byte); var m1,m2,m3,m4:word; StoreClick1,StoreClick2:boolean; implementation var minst:boolean; Op:word; Oc:word; Cc:word; regs:registers; procedure MsMouse(var M1,M2,M3,M4:word); var regs : registers; begin regs.ax:=m1; regs.bx:=m2; regs.cx:=m3; regs.dx:=m4; intr($33,regs); m1:=regs.ax; m2:=regs.bx; m3:=regs.cx; m4:=regs.dx; end; procedure PMouse(var m1,m2,m3,m4:word); begin if minst then MsMouse(m1,m2,m3,m4) else begin m1:=0; m2:=0; m3:=0; m4:=0; end; end; procedure InitM; var x,y:integer; mode: byte absolute $40:$49; begin mode:=3; if Minst then begin m1:=2; PMouse(m1,m2,m3,m4); m1:=3; PMouse(m1,m2,m3,m4); x:=m3; y:=m4; end else begin x:=320; y:=100; end; m1:=0; Msmouse(m1,m2,m3,m4); if m1=0 then minst:=false else minst:=true; m1:=1; PMouse(m1,m2,m3,m4); m1:=10; m2:=0; m3:=$F000; m4:=$0C18; PMouse(m1,m2,m3,m4); m1:=4; m3:=x; m4:=y; PMouse(m1,m2,m3,m4); m1:=7; m3:=0; m4:=(MaxWidth-1)*8; PMouse(m1,m2,m3,m4); m1:=8; m3:=0; m4:=(MaxHeight-1)*8; PMouse(m1,m2,m3,m4); end; procedure InitGM; m1:=2; PMouse(m1,m2,m3,m4); m1:=3; PMouse(m1,m2,m3,m4); x:=m3; y:=m4; end else begin x:=320; y:=100; end; m1:=0; Msmouse(m1,m2,m3,m4); if m1=0 then minst:=false else minst:=true; m1:=1; PMouse(m1,m2,m3,m4); m1:=10; m2:=0; m3:=$F000; m4:=$0C18; PMouse(m1,m2,m3,m4); m1:=4; m3:=x; m4:=y; PMouse(m1,m2,m3,m4); m1:=7; m3:=0; m4:=639; PMouse(m1,m2,m3,m4); m1:=8; m3:=0; m4:=479; PMouse(m1,m2,m3,m4); end; procedure Hidem; begin m1:=2; PMouse(m1,m2,m3,m4); end; procedure Showm; begin m1:=1; Pmouse(m1,m2,m3,m4); end; Function Click1:boolean; begin if StoreClick1 then begin Click1:=true; StoreClick1:=false; exit; end; m1:=6; m2:=1*Ord(Lefty); pmouse(m1,m2,m3,m4); if (m2<>0) then Click1:=true else Click1:=false; end; Function Click2:boolean; begin if StoreClick2 then begin Click2:=true; StoreClick2:=false; exit; end; m1:=6; m2:=1*Ord(Not Lefty); pmouse(m1,m2,m3,m4); if (m2<>0) then Click2:=true else Click2:=false; end; Function Click3:boolean; begin m1:=6; m2:=2; pmouse(m1,m2,m3,m4); if (m2<>0) then Click3:=true else Click3:=false; end; Procedure StoreClick(C:byte); begin case c of 1:StoreClick1:=true; 2:StoreClick2:=true; end; end; Function But1:boolean; begin m1:=3; Pmouse(m1,m2,m3,m4); if (m2 and (ord(lefty)+1)=(ord(Lefty)+1)) then But1:=true else But1:=false; end; function But3:boolean; begin m1:=3; pmouse(m1,m2,m3,m4); if (m2 and 4)=4 then But3:=true else But3:=false; end; Function But2:boolean; begin m1:=3; Pmouse(m1,m2,m3,m4); if (m2 and (ord(not lefty)+1)=(ord(not Lefty)+1)) then But2:=true else But2:=false; end; Function ReadMx:integer; begin m1:=3; Pmouse(m1,m2,m3,m4); ReadMx:=m3 div 8; end; Function ReadMy:integer; begin m1:=3; Pmouse(m1,m2,m3,m4); ReadMy:=m4 div 8; end; Function Mx:integer; begin m1:=3; Pmouse(m1,m2,m3,m4); Mx:=m3; end; Function My:integer; begin m1:=3; Pmouse(m1,m2,m3,m4); My:=m4; end; begin StoreClick1:=false; StoreClick2:=false; end. -- Jeff Watkins gt3070b@prism.gatech.edu "All opinions are mine... so don't even think of keeping some to yourself!"