program vesamouse;

uses crt;

const seta:array[0..15,0..7] of word=(

 (  0,999,999,999,999,999,999,999),
 (  0,  0,999,999,999,999,999,999),
 (  0, 15,  0,999,999,999,999,999),
 (  0, 15, 15,  0,999,999,999,999),
 (  0, 15, 15, 15,  0,999,999,999),
 (  0, 15, 15,  0,  0,999,999,999),
 (  0,  0, 15,  0,999,999,999,999),
 (  0,999,  0, 15, 0 ,999,999,999),
 (999,999,  0, 15, 0 ,999,999,999),
 (999,999,999,  0, 15,  0,999,999),
 (999,999,999,  0, 15,  0,999,999),
 (999,999,999,  0,  0,  0,999,999),
 (999,999,999,999,999,999,999,999),
 (999,999,999,999,999,999,999,999),
 (999,999,999,999,999,999,999,999),
 (999,999,999,999,999,999,999,999)
 );

var mode,m,n,xmax,ymax:word;
    c:char;
    buf:array[0..255] of byte;
    sos,ooo:word;
    bank:byte;
    mx,my,mb:word;
    mask:array[0..15,0..7] of byte;
    oldseg,oldofs,oldmask:word;
    newseg,newofs,newmask:word;

{$F+}
procedure SetPixel(X, Y : Word; C : word);
var z1,z2,q,w:longint;
    b:word;
begin
 if c<=255 then begin
 z1:=y;z2:=xmax;
 q:=z1*z2+x;
 b:=q div 65536;
 b:=b*bank;
 asm
   mov ax,$4f05
   mov bx,0
   mov dx,b
   int $10
 end;
 if ((x<xmax) and (y<ymax)) then mem[$a000:q]:=c;end;
end;

function GetPixel(X, Y : Word):byte;
var z1,z2,q,w:longint;
    b:word;
begin
 z1:=y;z2:=xmax;
 q:=z1*z2+x;
 b:=q div 65536;
 b:=b*bank;
 asm
   mov ax,$4f05
   mov bx,0
   mov dx,b
   int $10
 end;
 getpixel:=mem[$a000:q];
end;

procedure newmouse(Flags,CS,IP,AX,BX,CX,DX,SI,DI,DS,ES,BP : word);interrupt;
var hx,hy,hb,ev:word;
    hn,hm:integer;

begin
 ev:=ax;
 hx:=cx;
 hy:=dx;
 hb:=bx;

 if ((hx<>mx) or (hy<>my)) then
  begin
   for hn:=0 to 15 do
    for hm:=0 to 7 do
     setpixel(mx+hm,my+hn,mask[hn,hm]);
   for hn:=0 to 15 do
    for hm:=0 to 7 do
     mask[hn,hm]:=getpixel(hx+hm,hy+hn);
   for hn:=0 to 15 do
    for hm:=0 to 7 do
     setpixel(hx+hm,hy+hn,seta[hn,hm]);

   mx:=hx;
   my:=hy;
  end;

 inline ($8B/ $E5/ $5D/ $07/ $1F/ $5F/ $5E/ $5A/ $59/$5B/ $58/ $CB);
end;

{$F-}

begin
 mx:=0;
 my:=0;
 mode:=$101;
 sos:=seg(buf);
 ooo:=ofs(buf[0]);
 asm
  mov ax,$4f02
  mov bx,mode
  int $10
 end;
 asm
  mov ax,$4f01
  mov cx,mode
  mov es,sos
  mov di,ooo
  int $10
 end;

 if memw[sos:ooo+4]=0 then memw[sos:ooo+4]:=1;
 bank:=memw[sos:ooo+6] div memw[sos:ooo+4];

 xmax:=memw[sos:ooo+$12];
 ymax:=memw[sos:ooo+$14];
 if xmax=0 then begin xmax:=320;ymax:=200;bank:=0;end;

 for n:=0 to 200 do
  for m:=0 to 200 do
   setpixel(n,m,(n+m) div 2);

 for n:=0 to 15 do
  for m:=0 to 7 do
   mask[n,m]:=getpixel(n,m);
 

 newseg:=seg(newmouse);
 newofs:=ofs(newmouse);
 newmask:=1;

 asm
  mov ax,0
  int $33
  mov ax,1
  int $33
  mov ax,2
  int $33
  mov ax,8
  mov cx,0
  mov dx,ymax
  int $33
  mov ax,20
  mov cx,newmask
  mov es,newseg
  mov dx,newofs
  int $33
 end;

 repeat
 until ((keypressed));

 c:=readkey;
 asm
  mov ax,2
  int $33
  mov ax,20
  mov cx,oldmask
  mov es,oldseg
  mov dx,oldofs
  int $33
 end;
 asm
  mov ax,3
  int $10
 end;
end.



This page hosted by  Get your own Free Homepage