330 likes | 634 Views
Mouse handling. Suthida Chaichomchuen std@kmtnb.ac.th. Mouse Features. Pixel Mouse pointer Mickey Mickey count Threshold speed Use INT 33H functions AX = function values. Mouse Functions. 00H : Initialize the mouse 01H : Display the mouse pointer 02H : Conceal the mouse pointer
E N D
Mouse handling Suthida Chaichomchuen std@kmtnb.ac.th
Mouse Features • Pixel • Mouse pointer • Mickey • Mickey count • Threshold speed • Use INT 33H functions • AX = function values
Mouse Functions • 00H : Initialize the mouse • 01H : Display the mouse pointer • 02H : Conceal the mouse pointer • 03H : Get button status and pointer location • 04H : Set pointer location • 05H : Get button-press information • 06H : Get button-release information • 07H : Set horizontal limits for pointer • 08H : Set vertical limits for pointer
Mouse Functions • 09H : Set graphics pointer type • 0AH : Set text pointer type • 0BH : Read mouse-motion counters • 0CH : Install interrupt handler for mouse events • 0DH : Turn on light pen emulation • 0EH : Turn off light pen emulation • 0FH : Set mickey-to-pixel ratio • 10H : Set pointer exclusion area • 13H : Set double-speed threshold • 14H : Swap mouse-event interrupt
Mouse Functions • 15H : Get buffer size for mouse driver state • 16H : Save mouse driver state • 17H : Restore mouse driver state • 18H : Install alternative handler for mouse events • 19H : Get address of alternative handler • 1AH : Set mouse sensitivity • 1BH : Get mouse sensitivity • 1CH : Set mouse interrupt rate • 1DH : Select display page for pointer • 1EH : Get display page for pointer
Mouse Functions • 1FH : Disable mouse driver • 20H : Enable mouse driver • 21H : Reset mouse driver • 22H : Set language for mouse driver messages • 23H : Get language number • 24H : Get mouse information
INT 33H Function 00H • Initialize the mouse • AX = 00H • Values return of operation • AX = 0000H : no mouse support is available • AX = FFFFH : mouse support is available • BX = number of mouse buttons • Example • MOV AX,00H • INT 33H
INT 33H Function 01H • Display the mouse pointer • AX = 01H • Example • MOV AX,01H • INT 33H
INT 33H Function 02H • Conceal the mouse pointer • AX = 02H • Example • MOV AX,02H • INT 33H
INT 33H Function 03H • Get button status and pointer location • AX = 03H • Values return • BX = status of buttons • bit 0 : left button (0=up , 1=pressed down) • bit 1 : right button (0=up , 1=pressed down) • bit 2 : center button (0=up , 1=pressed down) • bit 3-15 : reserved for internal use • CX = horizontal (x) coordinate • DX = vertical (y) coordinate
INT 33H Function 03H • Example • MOV AX,03H • INT 33H
INT 33H Function 04H • Set pointer location • AX = 04H • CX = horizontal location • DX = vertical location • Example • MOV AX,04H • MOV CX,horiz-locn • MOV DX,vertl-locn • INT 33H
Example : Basic mouse operations • MOV AX,00H • INT 33H • CMP AX,00H • JE exit • MOV AX,01H • INT 33H • MOV AX,04H • MOV CX,24 • MOV DX,16 • INT 33H • . . . • MOV AX,02H • INT 33H
INT 33H Function 05H • Get button-press information • AX = 05H • BX = button number • 0 = left • 1 = right • 2 = center • Example • MOV AX,05H • MOV BX,button-no • INT 33H
INT 33H Function 05H • Values return • AX = status of buttons • bit 0 : left button (0=up , 1=pressed down) • bit 1 : right button (0=up , 1=pressed down) • bit 2 : center button (0=up , 1=pressed down) • bit 3-15 : reserved for internal use • BX = button-press counter • CX = horizontal coordinate of last button press • DX = vertical coordinate of last button press
INT 33H Function 06H • Get button-release information • AX = 06H • BX = button number • 0 = left • 1 = right • 2 = center • Example • MOV AX,06H • MOV BX,button-no • INT 33H
INT 33H Function 06H • Values return • AX = status of buttons • bit 0 : left button (0=up , 1=pressed down) • bit 1 : right button (0=up , 1=pressed down) • bit 2 : center button (0=up , 1=pressed down) • bit 3-15 : reserved for internal use • BX = button-release counter • CX = horizontal coordinate of last button release • DX = vertical coordinate of last button release
INT 33H Function 07H • Set horizontal limits for pointer • AX = 07H • CX = minimum limit • DX = maximum limit • Example • MOV AX,07H • MOV CX,min-locn • MOV DX,max-locn • INT 33H
INT 33H Function 08H • Set vertical limits for pointer • AX = 08H • CX = minimum limit • DX = maximum limit • Example • MOV AX,08H • MOV CX,min-locn • MOV DX,max-locn • INT 33H
INT 33H Function 0BH • Read mouse-motion counters • Range (-32768 to +32767) • AX = 0BH • Values return • CX = horizontal count • (+ : travel to the right, - : left) • DX = vertical count • (+ : travel downwards, - : upwards) • Example • MOV AX,0BH • INT 33H
INT 33H Function 0CH • Install interrupt handler for mouse events • AX = 0CH • CX = address of event mask • DX = address of handler (ES:DX) • Example • MOV AX,0CH • LEA CX,mask • LEA DX,handler • INT 33H
INT 33H Function 0CH • Bits for define the event mask • 0 = mouse pointer moved • 1 = left button pressed • 2 = left button released • 3 = right button pressed • 4 = right button released • 5 = center button pressed • 6 = center button released • 7-15 = reserved, define as 0
INT 33H Function 0CH • Define the interrupt handler as a FAR procedure • AX = event mask • BX = button state • CX = horizontal coordinate • DX = vertical coordinate • SI = last vertical mickey count • DI = last horizontal mickey count • DS = data segment for the mouse driver
INT 33H Function 10H • Set pointer exclusion area • AX = 10H • CX = upper left x coordinate • DX = upper left y coordinate • SI = lower right x coordinate • DI = lower right y coordinate
INT 33H Function 10H • Example • MOV AX,10H • MOV CX,upleft-x • MOV DX,upleft-y • MOV SI,lowrgt-x • MOV DI,lowrgt-y • INT 33H
INT 33H Function 13H • Set double-speed threshold • Default speed = 64 mickeys per second • AX = 13H • DX = value of threshold speed • Example • MOV AX,13H • MOV DX,threshold • INT 33H
INT 33H Function 1AH • Set mouse sensitivity • AX = 1AH • BX = horizontal mickeys (default = 8) • CX = vertical mickeys (default = 16) • DX = threshold speed (default = 64) • Example • MOV AX,1AH • MOV BX,horzon • MOV CX,vertic • MOV DX,threshold • INT 33H
INT 33H Function 1BH • Get mouse sensitivity • AX = 1BH • Return values to registers as function 1AH • Example • MOV AX,1BH • INT 33H
INT 33H Function 1DH • Select display page for pointer • AX = 1DH • BX = page number • Example • MOV AX,1DH • MOV BX,00 • INT 33H
INT 33H Function 1EH • Get display page for pointer • AX = 1EH • Return value of page number in the BX • Example • MOV AX,1EH • INT 33H
INT 33H Function 24H • Get mouse information • AX = 24H • Return information about version and type • Values return • BH = major version number • BL = minor version number • CH = mouse type • 1 = bus mouse • 2 = serial mouse • 3 = InPort mouse • 4 = PS/2 mouse • 5 = HP mouse
INT 33H Function 24H • Example • MOV AX,24H • INT 33H