Rev 5075 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5075 | Rev 5076 | ||
---|---|---|---|
Line 137... | Line 137... | ||
137 | ; Check if a MS type serial mouse is connected |
137 | ; Check if a MS type serial mouse is connected |
Line 138... | Line 138... | ||
138 | 138 | ||
139 | ; Disable power and mouse interrupts |
139 | ; Disable power and mouse interrupts |
140 | mov dx, bx |
140 | mov dx, bx |
141 | add dx, 4 ; modem control register |
141 | add dx, 4 ; modem control register |
142 | mov al, 0 ; reset DTR, RTS, and OUT2 |
142 | mov al, 0 ; reset DTR, RTS, and AUX2 |
Line 143... | Line 143... | ||
143 | out dx, al |
143 | out dx, al |
144 | 144 | ||
145 | ; Wait 5 ticks (0.2s) |
145 | ; Wait 5 ticks (0.2s) |
Line 156... | Line 156... | ||
156 | 156 | ||
157 | ; Clear data register |
157 | ; Clear data register |
158 | mov dx, bx |
158 | mov dx, bx |
Line 159... | Line 159... | ||
159 | in al, dx |
159 | in al, dx |
160 | 160 | ||
161 | ; set DTR, DTS and OUT2 |
161 | ; Power on the mouse |
162 | add dx, 4 |
162 | add dx, 4 |
Line 163... | Line 163... | ||
163 | mov al, 1011b |
163 | mov al, 1011b ; set DTR, DTS and AUX2 |
164 | out dx, al |
164 | out dx, al |
165 | 165 | ||
Line 277... | Line 277... | ||
277 | 277 | ||
278 | ; Left and Right Buttons |
278 | ; Left and Right Buttons |
279 | mov al, [esi + com_mouse_data.data+0] |
279 | mov al, [esi + com_mouse_data.data+0] |
280 | mov ah, al |
280 | mov ah, al |
281 | shr al, 3 ; right mouse button |
281 | shr al, 3 ; right mouse button |
282 | and al, 2 ; |
282 | and al, 10b ; |
283 | shr ah, 5 ; left mouse button |
283 | shr ah, 5 ; left mouse button |
284 | and ah, 1 ; |
284 | and ah, 1b ; |
285 | add al, ah |
285 | or al, ah |
286 | movzx eax, al |
286 | and [BTN_DOWN], not 11b |
Line 287... | Line 287... | ||
287 | mov [BTN_DOWN], eax |
287 | or byte[BTN_DOWN], al |
288 | 288 | ||
289 | ; X coordinate |
289 | ; X coordinate |
290 | mov al, [esi + com_mouse_data.data+0] |
290 | mov al, [esi + com_mouse_data.data+0] |
Line 307... | Line 307... | ||
307 | pop esi |
307 | pop esi |
308 | mov al, 1 |
308 | mov al, 1 |
309 | ret |
309 | ret |
Line 310... | Line 310... | ||
310 | 310 | ||
- | 311 | .FourthByte: |
|
- | 312 | cmp [esi + com_mouse_data.offset], 2 |
|
311 | .FourthByte: |
313 | jne .end |
Line -... | Line 314... | ||
- | 314 | inc [esi + com_mouse_data.offset] |
|
312 | inc [esi + com_mouse_data.offset] |
315 | |
313 | 316 | and [BTN_DOWN], not 100b |
|
314 | test al, 00100000b |
317 | test al, 00100000b |
- | 318 | jz @f |
|
315 | jz .end |
319 | or byte[BTN_DOWN], 100b |
Line 316... | Line 320... | ||
316 | or [BTN_DOWN], 100b |
320 | @@: |
317 | invoke SetMouseData, [BTN_DOWN], [MOUSE_X], [MOUSE_Y], 0, 0 |
321 | invoke SetMouseData, [BTN_DOWN], 0, 0, 0, 0 |
318 | 322 | ||
319 | .end: |
323 | .end: |