mousep	PROC
	push	bx
	push	cx
	push	dx
	xor	ax,ax
	cmp	cs:[__mouse],al
	je	mousep_00
	mov	ax,6
	int	33h
	or	al,al
    mousep_00:
	pop	dx
	pop	cx
	pop	bx
	ret
mousep	ENDP

mouseon	PROC
	mov	ax,1
	cmp	al,cs:[__mbool]
	je	mouseon_00
	cmp	ah,cs:[__mouse]
	je	mouseon_00
	mov	cs:[__mbool],al
	int	33h
    mouseon_00:
	ret
mouseon	ENDP

mouseoff PROC
	xor	ax,ax
	cmp	al,cs:[__mbool]
	jz	mouseoff_00
	mov	cs:[__mbool],al
	mov	ax,2
	int	33h
    mouseoff_00:
	ret
mouseoff ENDP

mousex	PROC
	push	bx
	push	cx
	push	dx
	xor	ax,ax
	cmp	al,cs:[__mouse]
	je	mousex_00
	mov	al,3
	int	33h
	mov	ax,cx
	shr	ax,3
    mousex_00:
	pop	dx
	pop	cx
	pop	bx
	ret
mousex	ENDP

mousey	PROC
	push	bx
	push	cx
	push	dx
	xor	ax,ax
	cmp	al,cs:[__mouse]
	je	mousey_00
	mov	ax,3
	int	33h
	mov	ax,dx
	shr	ax,3
    mousey_00:
	pop	dx
	pop	cx
	pop	bx
	ret
mousey	ENDP

mousexy PROC
	push	dx
	push	cx
	push	ax
	xor	dx,dx
	mov	cx,dx
	cmp	cl,cs:[__mouse]
	je	mousexy_00
	mov	dl,ah
	mov	cl,al
	shl	cx,3
	shl	dx,3
	mov	ax,4
	int	33h
    mousexy_00:
	pop	ax
	pop	cx
	pop	dx
	ret
mousexy ENDP

mousehide PROC
	push	ax
	call	mouseoff
	shr	al,1
	mov	ah,cs:[__mflag]
	shl	ah,1
	or	al,ah
	mov	cs:[__mflag],al
	pop	ax
	ret
mousehide ENDP

mouseshow PROC
	push	ax
	mov	al,cs:[__mflag]
	shr	al,1
	mov	cs:[__mflag],al
	jnc	mouseshow_00
	call	mouseon
    mouseshow_00:
	pop	ax
	ret
mouseshow ENDP

