Home Random Page


CATEGORIES:

BiologyChemistryConstructionCultureEcologyEconomyElectronicsFinanceGeographyHistoryInformaticsLawMathematicsMechanicsMedicineOtherPedagogyPhilosophyPhysicsPolicyPsychologySociologySportTourism






Work with a mouse.

All communication with the mouse is carried out through interruption 33h which handler installs the driver of the mouse loaded usually at start of system. Modern drivers support about 60 functions, allowing to adjust resolution of the mouse, profiles of accelerations, virtual coordinates, to adjust additional event handlers, etc. The majority of these functions are required seldom, now we will consider the main:

INT 33h, AX = 0 — Initialization of the mouse

Input: AX = 0000h

Output: ÀÕ = 0000h, if the mouse or the driver of the mouse aren't established

ÀÕ = FFFFh, if the driver and the mouse are established

ÂÕ = number of buttons:

0002 èëè FFFF — two

0003 — three

0000 — other quantity

Hardware and program dumping of the mouse and the driver is carried out.

INT 33h, AX = 1 — Show the cursor

Input: AX = 0001h

INT 33h, AX = 2 — Hide the cursor

Input: AX = 0002h

The driver of the mouse supports the internal counter operating visibility of the mouse pointer. Function 2 reduces value of the counter by one, and function 1 increases it, but only to value 0. If value of the counter — a negative number, it is hidden if zero — is shown. It allows the procedures using direct output in video memory, causing function 2 at the beginning and 1 — right at the end, without caring of in what condition there was the mouse pointer at the program which have caused this procedure.

INT 33h, AX = 3— Determine the mouse condition

Input: AX = 0003h

Output: ÂÕ = condition of buttons:

bit 0 — the left button is pressed

bit 1 — the right button is pressed

bit 2 — the average button is pressed

ÑÕ = Õ-coordinate

DX = Y-coordinate

Returned coordinates coincide with pixel coordinates of the corresponding point on the screen in the majority of graphic modes, except 04, 05, 0Dh, 13h in which the Hcoordinate

of the mouse needs to be divided on 2 to receive number of a column of the corresponding point on the screen. In text modes both coordinates should be divided on 8 to receive number of a string and a column respectively.

In most cases this function isn't used in programs as to react to pressing of the button or moving of the mouse to the given area, it is required to cause this interruption constantly that leads to expenditure of processor time. Functions 5 (define the cursor position by the last pressing of the button), 6 (define the cursor position at the last releasing of the button) and 0Bh (define the distance passed by the mouse) can help to optimize work of the program which is independently watching all movement of the mouse, but much more effectively to specify to the driver most to watch her movement (than it, actually, and is engaged constantly) and to transfer control in the program as soon as in advance defined condition will be satisfied, for example the user will press the left button of the mouse. Such service is provided by function 0Ch — establish the event handler.

INT 33h, AX = 0Ch—Establish the event handler



Input: AX = 000Ch

ES:DX = the handler address

ÑÕ = condition of the call

bit 0 — any movement of the mouse ìûøè

bit 1 —pressing of the left button

bit 2 — releasing of the left button

bit 3 —pressing of the right button

bit 4 — releasing of the right button

bit 5 —pressing of the average button

bit 6 — releasing of the average button

ÑÕ = 0000h — cancel the handler

The event handler has to be issued, as far procedure (that is to come to the end with the RETF command). On an entrance to procedure of the handler AH contains a condition of the call, VH — a condition of the buttons, CX, DX — X-and Y-coordinates of the cursor, SI, DI — counters of the last movement across and verticals (units of measure for these counters — mikes, 1/200 inches), DS — a segment of data of the driver of the mouse. Before program end the established event handler has to be surely removed (a function 0Ch call with CX = 0) as differently at the first performance of a condition control will be transferred to the address in memory with which the handler began.

 

 


Date: 2015-01-29; view: 1237


<== previous page | next page ==>
Types of Windows drivers. | System timer.
doclecture.net - lectures - 2014-2024 year. Copyright infringement or personal data (0.007 sec.)