Unit Mouse; Interface Type Str13 = String[13]; Procedure ShowCursor; Procedure HideCursor; Procedure MouseGotoXY(X, Y:Word); Function MouseInstalled:Boolean; Procedure GetMouseStatus(Var Button:Byte; Var X, Y:Word); Procedure GetMouseButtonPress(Var Button, X, Y:Word); Procedure GetMouseButtonRelease(Var Button, X, Y:Word); Procedure SetCursorXRange(MinX, MaxX:Word); Procedure SetCursorYRange(MinY, MaxY:Word); Procedure SetCursorRange(MinX, MinY, MaxX, MaxY:Word); Procedure SetGraphCursorShape(HotX, HotY:Integer; Address:Pointer); Procedure SetTextCursorShape(ScreenMask, CursorMask:Word); Procedure SetHardwareCursor(FirstLn, LastLn:Word); Procedure GetRelativeMove(Var X, Y:Integer); Procedure SetMouseHandler(Mask:Integer; Handler:Pointer); Procedure SetLightPenEmulation(LightPen:Boolean); Procedure SetMickeyRatio(X, Y:Integer); Procedure SetHideCursorWindow(X0, Y0, X1, Y1:Word); Function DefineGraphicCursor(Width, Height, HotSpotX, HotSpotY:Byte; Masks:Pointer):Integer; Procedure SetMouseThreshold(Threshold:Integer); Function ExchangeMouseHandler(Mask:Integer; Handler:Pointer; Var OldMask:Integer):Pointer; Function GetMouseStateSize:Word; Procedure SaveMouseDriverState(Address:Pointer); Procedure RestoreMouseDriverState(Address:Pointer); Function SetAlternateMouseHandler(Mask:Integer; Handler:Pointer):Boolean; Function GetAlternateMouseHandler(Mask:Integer):Pointer; Procedure SetMouseSensitivity(Horiz, Vert, Threshold:Integer); Procedure SetMouseInterruptRate(Rate:Integer); Procedure SetMousePage(Page:Word); Function GetMousePage:Word; Function DisableMouseDriver:Pointer; Function EnableMouseDriver:Boolean; Procedure ResetMouseSoftware(Var Installed:Boolean; Var Buttons:Word); Procedure SetMouseLanguage(Language:Integer); Function GetMouseLanguage:Str13; Function GetMouseVersion:Word; Function GetMousePort:String; Function GetMouseButtonCount:Word; Function GetMouseIRQ:Byte; Function GetMouseCursor:Byte; Function GetMouseMinX:Word; Function GetMouseMinY:Word; Function GetMouseMaxX:Word; Function GetMouseMaxY:Word; Function GetMouseHSpeed:Word; Function GetMouseVSpeed:Word; Function GetMouseThreshold:Word; Function GetScreenMask:Word; Function GetCursorMask:Word; Function GetMouseHotX:Integer; Function GetMouseHotY:Integer; Implementation Function MouseInstalled:Boolean; Assembler; asm xor ax, ax int 33h end; Procedure ShowCursor; Assembler; asm mov ax, 0001h int 33h end; Procedure HideCursor; Assembler; asm mov ax, 0002h int 33h end; Procedure GetMouseStatus(Var Button:Byte; Var X, Y:Word); Assembler; asm mov ax, 0003h int 33h mov al, bl les di, Button stosb mov ax, cx les di, X stosw mov ax, dx les di, Y stosw end; Procedure MouseGotoXY(X, Y:Word); Assembler; asm mov ax, 0004h mov cx, X mov dx, Y int 33h end; Procedure GetMouseButtonPress(Var Button, X, Y:Word); Assembler; asm mov ax, 0005h int 33h les di, Button stosw mov ax, cx les di, x stosw mov ax, dx les di, y stosw end; Procedure GetMouseButtonRelease(Var Button, X, Y:Word); Assembler; asm mov ax, 0006h int 33h les di, Button stosw mov ax, cx les di, X stosw mov ax, dx les di, Y stosw end; Procedure SetCursorXRange(MinX, MaxX:Word); Assembler; asm mov ax, 0007h mov cx, MinX mov dx, MaxX int 33h end; Procedure SetCursorYRange(MinY, MaxY:Word); Assembler; asm mov ax, 0008h mov cx, MinY mov dx, MaxY int 33h end; Procedure SetCursorRange(MinX, MinY, MaxX, MaxY:Word); Assembler; asm mov ax, 0007h mov cx, MinX mov dx, MaxX int 33h mov ax, 0008h mov cx, MinY mov dx, MaxY int 33h end; Procedure SetGraphCursorShape(HotX, HotY:Integer; Address:Pointer); Assembler; asm mov ax, 0009h mov bx, word ptr HotX mov cx, word ptr HotY les dx, Address int 33h end; Procedure SetTextCursorShape(ScreenMask, CursorMask:Word); Assembler; asm mov ax, 000Ah xor bx, bx mov cx, ScreenMask mov dx, CursorMask int 33h end; Procedure SetHardwareCursor(FirstLn, LastLn:Word); Assembler; asm mov ax, 000Ah mov bx, 0001h mov cx, FirstLn mov dx, LastLn int 33h end; Procedure GetRelativeMove(Var X, Y:Integer); Assembler; asm mov ax, 000Bh int 33h mov ax, cx les di, x stosw mov ax, dx les di, y stosw end; Procedure SetMouseHandler(Mask:Integer; Handler:Pointer); Assembler; asm mov ax, 000Ch mov cx, Mask les dx, Handler int 33h end; Procedure SetLightPenEmulation(LightPen:Boolean); Assembler; asm mov ax, 000Dh add al, LightPen int 33h end; Procedure SetMickeyRatio(X, Y:Integer); Assembler; asm mov ax, 000Fh mov cx, X mov dx, Y int 33h end; Procedure SetHideCursorWindow(X0, Y0, X1, Y1:Word); Assembler; asm mov ax, 0010h mov cx, X0 mov dx, Y0 mov si, X1 mov di, Y1 int 33h end; Function DefineGraphicCursor(Width, Height, HotSpotX, HotSpotY:Byte; Masks:Pointer):Integer; Assembler; asm mov ax, 0012h mov bh, Width mov ch, Height mov bl, HotSpotX mov cl, HotSpoty les dx, Masks int 33h end; Procedure SetMouseThreshold(Threshold:Integer); Assembler; asm mov ax, 0013h mov dx, Threshold int 33h end; Function ExchangeMouseHandler(Mask:Integer; Handler:Pointer; Var OldMask:Integer):Pointer; Assembler; asm les dx, Handler mov cx, Mask mov ax, 0014h int 33h push es push dx mov ax, cx les di, OldMask stosw pop ax pop dx end; Function GetMouseStateSize:Word; Assembler; asm mov ax, 0015h int 33h mov ax, bx end; Procedure SaveMouseDriverState(Address:Pointer); Assembler; asm mov ax, 0016h les dx, Address int 33h end; Procedure RestoreMouseDriverState(Address:Pointer); Assembler; asm mov ax, 0017h les dx, Address int 33h end; Function SetAlternateMouseHandler(Mask:Integer; Handler:Pointer):Boolean; Assembler; asm mov ax, 0018h mov cx, Mask les dx, Handler int 33h cmp ax, 0018h jne @@1 mov al, True ret @@1: mov al, False end; Function GetAlternateMouseHandler(Mask:Integer):Pointer; Assembler; asm mov cx, Mask mov ax, 0019h int 33h or cx, cx je @@1 mov ax, dx mov dx, bx ret @@1: xor dx, dx xor ax, ax end; Procedure SetMouseSensitivity(Horiz, Vert, Threshold:Integer); Assembler; asm mov ax, 001Ah mov bx, Horiz mov cx, Vert mov dx, Threshold int 33h end; Function GetMouseHSpeed:Word; Assembler; asm mov ax, 001Bh int 33h mov ax, bx end; Function GetMouseVSpeed:Word; Assembler; asm mov ax, 001Bh int 33h mov ax, cx end; Function GetMouseThreshold:Word; Assembler; asm mov ax, 001Bh int 33h mov ax, dx end; Procedure SetMouseInterruptRate(Rate:Integer); Assembler; asm mov bx, Rate mov ax, 001Ch int 33h end; Procedure SetMousePage(Page:Word); Assembler; asm mov ax, 001Dh mov bx, Page int 33h end; Function GetMousePage:Word; Assembler; asm mov ax, 001Eh int 33h mov ax, bx end; Function DisableMouseDriver:Pointer; Assembler; asm mov ax, 001Fh int 33h cmp ax, 001Fh je @@1 mov dx, es mov ax, bx ret @@1: xor dx, dx xor ax, ax end; Function EnableMouseDriver:Boolean; Assembler; asm mov ax, 0020h int 33h cmp ax, 0020h je @@1 mov al, True ret @@1: mov al, False end; Procedure ResetMouseSoftware(Var Installed:Boolean; Var Buttons:Word); Assembler; asm mov ax, 0021h int 33h les di, Installed stosw mov ax, bx les di, Buttons stosw end; Procedure SetMouseLanguage(Language:Integer); Assembler; asm mov ax, 0022h mov bx, Language int 33h end; Function GetMouseLanguage:Str13; Var I:Word; begin asm mov ax, 0023h int 33h mov I, bx end; Case I of 0:GetMouseLanguage:='английский'; 1:GetMouseLanguage:='французский'; 2, 3:GetMouseLanguage:='немецкий'; 4:GetMouseLanguage:='шведский'; 5:GetMouseLanguage:='финский'; 6:GetMouseLanguage:='испанский'; 7:GetMouseLanguage:='португальский'; 8:GetMouseLanguage:='итальянский'; end; end; Function GetMouseVersion:Word; Assembler; asm mov ax, 0024h int 33h mov ax, bx end; Function GetMousePort:String; Var Port:Byte; begin asm mov ax, 24h int 33h mov port, ch end; Case Port of 1:GetMousePort:='bus'; 2:GetMousePort:='последовательный'; 3:GetMousePort:='mouse'; 4:GetMousePort:='PS/2'; 5:GetMousePort:='Hewlett-Packard'; else GetMousePort:='неизвестный'; end; end; Function GetMouseButtonCount:Word; Assembler; asm call MouseInstalled mov ax, bx end; Function GetMouseIRQ:Byte; Assembler; asm mov ax, 0024h int 33h mov al, cl end; Function GetMouseCursor:Byte; Assembler; asm mov ax, 0025h int 33h shl ah, 2 shr ah, 6 mov al, ah end; Function GetScreenMask:Word; Assembler; asm mov ax, 0027h int 33h end; Function GetCursorMask:Word; Assembler; asm mov ax, 0027h int 33h mov ax, bx end; Function GetMouseHotX:Integer; Assembler; asm mov ax, 002Ah int 33h mov ax, bx end; Function GetMouseHotY:Integer; Assembler; asm mov ax, 002Ah int 33h mov ax, cx end; Function GetMouseMinX:Word; Assembler; asm mov ax, 0031h int 33h end; Function GetMouseMinY:Word; Assembler; asm mov ax, 0031h int 33h mov ax, bx end; Function GetMouseMaxX:Word; Assembler; asm mov ax, 0031h int 33h mov ax, cx end; Function GetMouseMaxY:Word; Assembler; asm mov ax, 0031h int 33h mov ax, dx end; end.