home *** CD-ROM | disk | FTP | other *** search
- procedure TextCursor (Start, Stop: integer);
- {Sets hardware mouse text cursor}
- begin
- Regs.AX := 10; {Mouse function 10}
- Regs.BX := 1; {Select hardware cursor}
- Regs.CX := Start; {Scan lines from start to stop are displayed}
- Regs.DX := Stop; {including all lines between start and stop}
- intr (51, Regs);
- end;
-
- procedure MakeGraphCursor (Cursor: CursorMasks; X, Y: integer);
- {Sets mouse graphics cursor. X and Y control hot spot}
- {Cursor[0..31] defines cursor mask}
- begin
- Regs.AX := 9; {Mouse function 9}
- Regs.BX := X; {Cursor hot spot x coordinate}
- Regs.CX := Y; {Cursor hot spot y coordinate}
- Regs.DX := Ofs (Cursor[0]); {Points to screen and cursor masks}
- Regs.ES := Seg (Cursor[0]);
- intr (51, Regs);
- end;
-
- procedure MouseReset(var Result: integer);
- {Resets mouse and checks for driver installation}
- begin
- Regs.AX := 0; {Mouse funtion 0}
- intr (51, Regs);
- Result := Regs.AX; {Returns 0 if not installed, -1 if installed}
- end;
-
- procedure IntSet (Mask: integer; Handler: integer);
- {Sets up an interrupt handler for mouse interrupt}
- {Conditions for interrupt are defined in Mask}
- const
- DSegPas: integer = 0; { reserve space to save DS }
- {set up executable code to call crambuffer}
- b1: byte = $1E; { PUSH DS save DS }
- b2: byte = $2E; { CS: }
- b3: byte = $8E; { MOV DS,[w2] load DS from DSegPas }
- b4: byte = $1E;
- w1: integer = 0;
- b7: byte = $50; { PUSH AX push regs }
- b8: byte = $53; { PUSH BX }
- b9: byte = $51; { PUSH CX }
- b10: byte = $52; { PUSH DX }
- b11: byte = $E8; { CALL CramBuffer }
- w2: integer = 0;
- b14: byte = $1F; { POP DS restore DS }
- b15: byte = $CB; { RETF }
- begin
- {$R-}
- DSegPas:=DSeg; { store data seg }
- w1:=Ofs(DSegPas); { store address in executable code above }
- w2:=Handler - Ofs(w2) - 2; { for near call instruction above }
- {$R+}
- Regs.AX := 12; {Mouse routine 12}
- Regs.CX := mask; {interrupt condition}
- Regs.ES := Cseg; {type constants located in CS}
- Regs.DX := Ofs(b1); {start executing code at b1}
- intr (51, Regs);
- end;
-
- procedure SetXLimits(Min, Max: integer);
- {restricts horizontal mouse movement on screen}
- begin
- Regs.AX := 7; {Mouse function 7}
- Regs.CX := Min; {Minimum horizontal position}
- Regs.DX := Max; {Maximum horizontal position}
- intr (51, Regs);
- end;
-
- procedure SetYLimits(Min, Max: integer);
- {restricts vertical mouse movement on screen}
- begin
- Regs.AX := 8; {Mouse function 8}
- Regs.CX := Min; {Minimum vertical position}
- Regs.DX := Max; {Maximum vertical position}
- intr (51, Regs);
- end;
-
- procedure GetPosition(var Status, X, Y: integer);
- {returns mouse coordinates and status of buttons}
- begin
- Regs.AX := 3; {Mouse function 3}
- intr (51, Regs);
- Status:= Regs.BX; {left=1, right=2, both=3}
- X:= Regs.CX; {New X coordinate}
- Y:= Regs.DX; {New Y coordinate}
- end;
-
- procedure CursorOn;
- {display cursor}
- begin
- Regs.AX := 1; {Mouse function 1}
- intr (51, Regs);
- end;
-
- procedure CursorOff;
- {hide cursor}
- begin
- Regs.AX := 2; {Mouse function 2}
- intr (51, Regs);
- end;
-