[comp.sys.ibm.pc] MicroSoft Mouse

djb@wjh12.harvard.edu (David J. Birnbaum) (10/30/89)

  My Hercules Graphics Card Plus requires a special screen
blanking utility, which Hercules thoughtfully supplies.  Un-
fortunately, this routine blanks the screen after five minutes
of no keyboard activity.  It does not check for mouse activity
and the screen frequently goes blank in the middle of mouse-
based applications.  I can restore it by touching alt or ctrl
or shift, but I'd prefer not to.

  Hercules sent me the assembler source code for the screen
blanker and I would like to modify it to check for mouse
activity.  If anyone out there has a mouse manual, could you
please send me email explaining how to do this?  I understand
that the mouse is called with 33h, but I have no idea what
goes in which register.

  Thanks for any suggestions.  I'll post a summary in a couple
of weeks.

--David
 
============================================================
David J. Birnbaum         djb@wjh12.harvard.edu [Internet]
                          djb@harvunxw.bitnet   [Bitnet]
============================================================

news@udenva.cair.du.edu (netnews) (11/30/89)

In article <423@wjh12.harvard.edu> djb@wjh12.UUCP (David J. Birnbaum) writes:
>blanker and I would like to modify it to check for mouse
>activity.  If anyone out there has a mouse manual, could you
>please send me email explaining how to do this?  I understand
>that the mouse is called with 33h, but I have no idea what
>goes in which register.

Here is some code that I use to monitor an IBM PS/2 mouse.  The documentation
for this mouse states that the device driver for the PS/2 mouse allows the
mouse to be used by applications that use the interface designed by Microsoft.
So this code might work for you with some minor adaptation, of course.

Just issue an Int 33h when it's time to blank the screen, and if the X or Y
or one of the button statuses has changed, treat it like a keystroke, i.e.
don't blank the screen.

;------------------------------------------------------------------------+
;									 |
;	G L O B A L   V A R I A B L E S 				 |
;									 |
;------------------------------------------------------------------------+

DATASEG segment word public 'data'

public	ps2_x_			;X coordinate of IBM PS/2 mouse
public	ps2_y_			;Y coordinate of IBM PS/2 mouse

ps2_x_		dw	0	;Start at 0,0
ps2_y_		dw	0	;Start at 0,0

DATA ends


;------------------------------------------------------------------------+
;	Code Segment							 |
;------------------------------------------------------------------------+

CODESEG segment word public 'code'
	assume	cs:CODESEG,ds:DATASEG,ss:DATASEG,es:DATASEG

;------------------------------------------------------------------------+
;	ps2_mouse() - Get data from an IBM PS/2 mouse.			 |
;									 |
;		      Returns button status in AX.			 |
;			 Bit 0 Left button (1 = down, 0 = up)		 |
;			 Bit 1 Right button (1 = down, 0 = up)		 |
;------------------------------------------------------------------------+
public ps2_mouse_
ps2_mouse_ proc near

	mov	ax,03		       ;3 = Get Position and Button Status
	int	33h		       ;Mouse driver interrupt

	mov	ax,bx		       ;AX = BX = button status
	mov	ds:ps2_x_,cx	       ;Store X position
	mov	ds:ps2_y_,dx	       ;Store Y position

	ret

ps2_mouse_ endp

;------------------------------------------------------------------------;
;------------------------------------------------------------------------;

CODESEG ends
	end