i want to write an assembly program that will detect if a mouse is present and the following:
1) number of mouse buttons
2) mouse driver version
3) mouse type and interrupt request number
4) mouse driver is a COM or SYS file
i know the answers
1) int 33h al=0 bx will give me mouse buttons
2)int 33h 24h bx
3) 24 h ch give me mouse type and cl give me interrupt request number
4)25 h if ax=0 that means its SYS if ax=1 its COM
and that is my code
please help me
===================================
Title detect mouse (Mouse.asm)
.model small
.stack 100h
.data
cr equ 0dh
lf equ 0ah
msg1 db "mouse not installed",cr,lf,lf,"$"
msg2 db "mouse is installed",cr,lf,lf,"$"
msg3 db "mouse detection"cr,lf,lf,"$"
display macro string
mov ah,9
mov dx,offset string
int 21h
endm
.code
main proc
mov ax,@data
mov ds,ax
mov ah,02
mov dx,0808h
mov bh,00
int 10h
display msg1
mov ah,35h
mov al,33h
int 20
mov ax,es
cmp ax,bx
jz no
jmp ins
no:
display msg2
mov ah,4ch
int 21h
ins:
display msg3
mov ah,4ch
int 21h
main endp
end main
========================
Hi,
mov ah,35h
mov al,33h
int 20
That looks like a typo. It probably should be Int 21H.
Steve
definately - INT 20 is INT 14h - rarely used for serial i/o
i would use...
mov ax,3533h
int 21h
number of mouse buttons
Interrupt 33h, Function 0: Mouse Reset and Status
Call with:
AX = 0
Returns:
AX = -1 if mouse found and reset, otherwise 0
BX = number of buttons
mouse driver version
mouse type and interrupt request number
Interrupt 33h, Function 36: Get Driver Version, Mouse Type, and IRQ Number
Call with:
AX = 36
Returns:
BX = mouse driver version number, major version in BH, minor version in BL
CH = mouse type
1 = bus mouse
2 = serial mouse
3 = inport mouse
4 = PS/2 mouse
5 = Hewlett-Packard mouse
probably others defined for later drivers
CL = IRQ number
0 = PS/2, otherwise IRQ
mouse driver is a COM or SYS file
Interrupt 33h, Function 37: Get General Driver Information
Call with:
AX = 37
Returns:
AX = general information
bit 15 represents driver type, 0 = COM file, 1 = SYS file
other bits represent other information
BX, CX, DX = other information
Quote from: FORTRANS on November 30, 2009, 10:24:19 PM
Hi,
mov ah,35h
mov al,33h
int 20
That looks like a typo. It probably should be Int 21H.
Steve
Quote from: dedndave on November 30, 2009, 11:56:02 PM
definately - INT 20 is INT 14h - rarely used for serial i/o
i would use...
mov ax,3533h
int 21h
thanks but how can i check
1) number of mouse buttons
2) mouse driver version
3) mouse type and interrupt request number
4) mouse driver is a COM or SYS file
without the debugger
==================
-a
17AB:0100 mov al,0
17AB:0102 int 33
17AB:0104 int 3
17AB:0105
-g=100
AX=FFFF BX=0002 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=17AB ES=17AB SS=17AB CS=17AB IP=0104 NV UP EI PL NZ NA PO NC
17AB:0104 CC INT 3
-
to reset mouse service routine
=====================================================================
-a
17AB:0100 mov al,1b
17AB:0102 int 33
17AB:0104 int 3
17AB:0105
-g=100
AX=001B BX=0032 CX=0032 DX=0032 SP=FFEE BP=0000 SI=0000 DI=0000
DS=17AB ES=17AB SS=17AB CS=17AB IP=0104 NV UP EI PL NZ NA PO NC
17AB:0104 CC INT 3
-
To get mouse sensitvity
=====================================================================
-a
17AB:0100 mov al,1a
17AB:0102 mov bx,15
17AB:0105 mov cx,20
17AB:0108 mov dx,25
17AB:010B int 33
17AB:010D int 3
17AB:010E
-g=100
AX=001A BX=0015 CX=0020 DX=0025 SP=FFEE BP=0000 SI=0000 DI=0000
DS=17AB ES=17AB SS=17AB CS=17AB IP=010D NV UP EI PL NZ NA PO NC
17AB:010D CC INT 3
-
to set mouse sensitvity
=====================================================================
-a
17AB:0100 mov al,24
17AB:0102 int 33
17AB:0104 int 3
17AB:0105
-g=100
AX=0024 BX=0800 CX=0302 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=17AB ES=17AB SS=17AB CS=17AB IP=0104 NV UP EI PL NZ NA PO NC
17AB:0104 CC INT 3
-
to get mouse driver
=====================================================================
-a
17AB:0100 mov al,25
17AB:0102 int 33
17AB:0104 int 3
17AB:0105
-g=100
AX=0100 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=17AB ES=17AB SS=17AB CS=17AB IP=0104 NV UP EI PL NZ NA PO NC
17AB:0104 CC INT 3
-
to get mouse information
=====================================================================
-a
17AB:0100 mov ah,35
17AB:0102 mov al,33
17AB:0104 int 21
17AB:0106 int 3
17AB:0107
-g=100
AX=3533 BX=23C4 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=17AB ES=032E SS=17AB CS=17AB IP=0106 NV UP EI PL NZ NA PO NC
17AB:0106 CC INT 3
-
=====================================================================
i guess i don't understand the problem
you seem to have the functions you need
you even seem to be able to make them work for you under debug
so - what's the trouble ?
here is a link to an INT 33h reference...
http://www.siddhant.name/text/int33.html
EDIT - i see something that may be causing you trouble
the function number needs to be in AX - not AL
AH needs to be 0
INT 33h is a little strange that way
another thing that may be causing problems for you is "focus"
your program needs to be on top and have windows focus in order for it to return proper info or for you to control the cursor
for example, if you move the mouse to a position outside your window, Windows takes control of the mouse