C
Program Mouse - gestionarea mouse-ului prin apelul intreruperii de sistem $33Program Mouse; uses Crt,Graph,Dos; var grDriver,grMode,ErrCode : Integer; mfunc,buton,mx,my,xf,yf,x,y:word; xi,yi:integer; s1,s2,s3:string[5]; P : pointer; Size : Word; procedure MouseAsm;ASSEMBLER; ASM MOV AX,mfunc MOV BX,buton MOV CX,mx MOV DX,my INT $33 MOV mfunc,AX MOV buton,BX MOV mx,CX MOV my,DX end; Begin grDriver := Detect; InitGraph(grDriver,grMode,''); ErrCode := GraphResult; if ErrCode = grOk then begin if mem[memW[0:$cc+2]:memW[0:$cc]]=$cf then begin outtext('Mouse-ul nu este instalat!'); readln;closegraph;halt; end; mfunc:=0;mouseasm; mfunc:=1;mouseasm; mfunc:=3; mouseasm;xi:=mx;yi:=my; setactivepage(1); rectangle(xi,yi,mx,my); Size := ImageSize(xi,yi,mx,my); GetMem(P, Size); GetImage(xi,yi,mx,my,P^); putimage(xi,yi,P^,XORput); setactivepage(0); PutImage(100, 100, P^, ORPut); repeat mouseasm; xi:=mx;yi:=my; while buton=1 do begin PutImage(100, 100, P^,XORPut); mouseasm; setactivepage(1); rectangle(xi,yi,mx,my); Size := ImageSize(xi,yi,mx,my); GetMem(P, Size); GetImage(xi,yi,mx,my,P^); putimage(xi,yi,P^,XORput); setactivepage(0); PutImage(100, 100, P^, ORPut); end; until keypressed; mfunc:=2;mouseasm; CloseGraph; end else WriteLn('Graphics error:',GraphErrorMsg(ErrCode)); end.
|