flat assembler
Message board for the users of flat assembler.

Index > DOS > How to use a Mouse?

Author
Thread Post new topic Reply to topic
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY 29 Apr 2004, 20:58
Could you please, give an example on hot to use mouse (handle clicks) under dos/win-dos-box?

Thanks!
Post 29 Apr 2004, 20:58
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 30 Apr 2004, 06:25
look for description of interrupt 31h services (i think, if not 31h then some similar number).
Post 30 Apr 2004, 06:25
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
zenek_tm



Joined: 21 Mar 2004
Posts: 33
Location: Poland
zenek_tm 30 Apr 2004, 09:01
Mouse functions are in 33h interrupt.
Post 30 Apr 2004, 09:01
View user's profile Send private message Reply with quote
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY 30 Apr 2004, 14:11
Ok, I That it is int 33h but how to use it?
Post 30 Apr 2004, 14:11
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 30 Apr 2004, 20:04
oops, sorry.
OzzY: just look for description of all int33h functions, for example
in Ralf's Brown interrupt list (search on net for it, it is everywhere)

There will be funtion to initialize mouse, function to show cursor, to get mouse coords etc...

only problems can be speed computations, because mouse returns shift in "mickeys" (from mickey mouse i quess) and you must recaulculate it to pixels. But i never did this in reality.
Post 30 Apr 2004, 20:04
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
zenek_tm



Joined: 21 Mar 2004
Posts: 33
Location: Poland
zenek_tm 30 Apr 2004, 20:49
To calculate from mickeys to pixels, first use 001bh function to get mickeys per pixel values for x and y axis. Then use function 000bh to get the shift of the mouse in mickeys. To get it in pixels just divide the values obtained using 000bh function by those obtained using 001bh function.
To get the new position of mouse cursor use 0003h function. But watch out, as this function returns x value in range 0-639.
Post 30 Apr 2004, 20:49
View user's profile Send private message Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 27 Oct 2004, 11:07
from asmcompo.org

i have included a smaller vewrsion Smile

note that mouse coordinates can be larger than 319=xmax.


Description: Draw circles at mose current position.
Download
Filename: zid.zip
Filesize: 2.96 KB
Downloaded: 827 Time(s)

Post 27 Oct 2004, 11:07
View user's profile Send private message Visit poster's website Reply with quote
zid



Joined: 03 Mar 2005
Posts: 1
zid 03 Mar 2005, 12:28
Wow, thats *my* demo, someone just posted me a link to this forum, very bizzare Razz

Code:
mov ax,03h    ;get mouse status
int 33h

cx = X co-ordinate
dx = y co-ordinate
    
Post 03 Mar 2005, 12:28
View user's profile Send private message Reply with quote
Bitdog



Joined: 18 Jan 2004
Posts: 97
Bitdog 13 Apr 2005, 06:34
Ralf Browns Port info, "GET MOUSE PACKET"
associated with IN AL,60h (get key press from port)
Has quick mouse stuff ?
There is a Port check to see if a mouse packet is ready.
One could make a macro to check for mouse movement/click
and scatter it about in the main program loop ?
I don't have specfic's available, only the above hints, sorry.
Post 13 Apr 2005, 06:34
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 13 Apr 2005, 10:08
i love the name "mickeys"
Post 13 Apr 2005, 10:08
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Bitdog



Joined: 18 Jan 2004
Posts: 97
Bitdog 21 Apr 2005, 06:56
I had a squeeky berring in my mouse & the tech on the phone said to:
look on the other end, lift the tail, squirt oil in the little hole,
but be care full not to get bit in the process.
So I looked for the hole under the cord,
and realized that the asshole was on the phone. Smile
Post 21 Apr 2005, 06:56
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1391
Location: Piraeus, Greece
Picnic 22 Nov 2007, 21:14
A program for xp console text mode, needs mouse initialization stuff?
I want to take the coords and i see that this simply works..

Code:
 mov ax,3            ; get mouse position cx = x, dx = y
     int 33h               ; mouse buttons: left bx = 1, right bx = 2, both bx = 3       
    
    shr cx,3              ; divide by 8 for 80x25 screen
        shr dx,3 
    

_________________
Hobby BASIC Interpreter
Post 22 Nov 2007, 21:14
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4347
Location: Now
edfed 22 Nov 2007, 22:41
int 33h is easy to use
from helppc, (c) david jurgens
Code:
^Mouse functions can be broken down into the following classes:

%     Mouse Driver Control / Feedback Functions
   ~INT 33,0~   Mouse Reset/Get Mouse Installed Flag
   ~INT 33,15~  Get Mouse Driver State and Memory Requirements
 ~INT 33,16~  Save Mouse Driver State
        ~INT 33,17~  Restore Mouse Driver State
     ~INT 33,1C~  Set Mouse Interrupt Rate (InPort only)
 ~INT 33,1F~  Disable Mouse Driver
   ~INT 33,20~  Enable Mouse Driver
    ~INT 33,21~  Reset Mouse Software
   ~INT 33,24~  Get Driver Version, Mouse Type & IRQ Number

%   Mouse Cursor Control Functions
      ~INT 33,1~   Show Mouse Cursor
      ~INT 33,2~   Hide Mouse Cursor
      ~INT 33,4~   Set Mouse Cursor Position
      ~INT 33,7~   Set Mouse Horizontal Min/Max Position
  ~INT 33,8~   Set Mouse Vertical Min/Max Position
    ~INT 33,9~   Set Mouse Graphics Cursor
      ~INT 33,A~   Set Mouse Text Cursor
  ~INT 33,F~   Set Mouse Mickey Pixel Ratio
   ~INT 33,10~  Mouse Conditional OFF
  ~INT 33,13~  Set Mouse Double Speed Threshold
       ~INT 33,1A~  Set Mouse Sensitivity
  ~INT 33,1B~  Get Mouse Sensitivity

%     Mouse Button and Position Feedback Functions
        ~INT 33,3~   Get Mouse Position and Button Status
   ~INT 33,5~   Get Mouse Button Press Information
     ~INT 33,6~   Get Mouse Button Release Information
   ~INT 33,B~   Read Mouse Motion Counters

%        Video Control and Feedback Functions
        ~INT 33,1D~  Set Mouse CRT Page
     ~INT 33,1E~  Get Mouse CRT Page

%        Mouse Interrupt Setup Functions
     ~INT 33,C~   Set Mouse User Defined Subroutine and Input Mask
       ~INT 33,14~  Swap Interrupt Subroutines

%        Alternate Mouse Interrupt Setup Functions
   ~INT 33,18~  Set Alternate Subroutine Call Mask and Address
 ~INT 33,19~  Get User Alternate Interrupt Address

%      Light Pen Emulation Functions
       ~INT 33,D~   Mouse Light Pen Emulation On
   ~INT 33,E~   Mouse Light Pen Emulation Off

%     International Language Support Functions
    ~INT 33,22~  Set Language for Messages
      ~INT 33,23~  Get Language Number

:int 33,0
^INT 33,0 - Mouse Reset/Get Mouse Installed Flag

       AX = 00


     on return:
      AX = 0000  mouse driver not installed
            FFFF  mouse driver installed
   BX = number of buttons


      - resets mouse to default driver values:

      .  mouse is positioned to screen center
     .  mouse cursor is reset and hidden
         .  no interrupts are enabled (mask = 0)
     .  double speed threshold set to 64 mickeys per second
      .  horizontal mickey to pixel ratio (8 to 8)
        .  vertical mickey to pixel ratio (16 to 8)
         .  max width and height are set to maximum for video mode
:int 33,1
^INT 33,1 - Show Mouse Cursor


       AX = 01


     returns nothing


     - increments the cursor flag;  the cursor is displayed if flag
        is zero;  default flag value is -1

:int 33,2
^INT 33,2 - Hide Mouse Cursor


  AX = 02


     returns nothing


     - decrements cursor flag; hides cursor if flag is not zero

:int 33,3
^INT 33,3 - Get Mouse Position and Button Status


 AX = 03


     on return:
      CX = horizontal (X) position  (0..639)
      DX = vertical (Y) position  (0..199)
        BX = button status:

         ³F-8³7³6³5³4³3³2³1³0³  Button Status
                ³  ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄÄ left button (1 = pressed)
               ³  ³ ³ ³ ³ ³ ³ ÀÄÄÄÄÄ right button (1 = pressed)
               ÀÄÄÁÄÁÄÁÄÁÄÁÄÁÄÄÄÄÄÄ unused


   - values returned in CX, DX are the same regardless of video mode

:int 33,4
^INT 33,4 - Set Mouse Cursor Position


     AX = 4
      CX = horizontal position
    DX = vertical position


      returns nothing


     - default cursor position is at the screen center
   - the position must be within the range of the current video mode
   - the position may be rounded to fit screen mode resolution

:int 33,5
^INT 33,5 - Get Mouse Button Press Information


  AX = 5
      BX = 0  left button
      1  right button


        on return:
      BX = count of button presses (0-32767), set to zero after call
      CX = horizontal position at last press
      DX = vertical position at last press
        AX = status:

                ³F-8³7³6³5³4³3³2³1³0³  Button Status
                ³  ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄÄ left button (1 = pressed)
               ³  ³ ³ ³ ³ ³ ³ ÀÄÄÄÄÄ right button (1 = pressed)
               ÀÄÄÁÄÁÄÁÄÁÄÁÄÁÄÄÄÄÄÄ unused

:int 33,6
^INT 33,6 - Get Mouse Button Release Information


  AX = 6
      BX = 0  left button
      1  right button


        on return:
      BX = count of button releases (0-32767), set to zero after call
     CX = horizontal position at last release
    DX = vertical position at last release
      AX = status

             ³F-8³7³6³5³4³3³2³1³0³  Button status
                ³  ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄÄ left button (1 = pressed)
               ³  ³ ³ ³ ³ ³ ³ ÀÄÄÄÄÄ right button (1 = pressed)
               ÀÄÄÁÄÁÄÁÄÁÄÁÄÁÄÄÄÄÄÄ unused

:int 33,7
^INT 33,7 - Set Mouse Horizontal Min/Max Position


 AX = 7
      CX = minimum horizontal position
    DX = maximum horizontal position


    returns nothing


     - restricts mouse horizontal movement to window
     - if min value is greater than max value they are swapped

:int 33,8
^INT 33,8 - Set Mouse Vertical Min/Max Position


   AX = 8
      CX = minimum vertical position
      DX = maximum vertical position


      returns nothing


     - restricts mouse vertical movement to window
       - if min value is greater than max value they are swapped

:int 33,9
^INT 33,9 - Set Mouse Graphics Cursor


     AX = 9
      BX = horizontal hot spot (-16 to 16)
        CX = vertical hot spot (-16 to 16)
  ES:DX = pointer to screen and cursor masks (16 byte bitmap)


     returns nothing


     - screen mask is AND'ed to screen Cursor Mask is XOR'ed
   - bytes 0-7 form the screen mask bitmap
     - bytes 8-F form the cursor mask bitmap

:int 33,a
^INT 33,A - Set Mouse Text Cursor


   AX = 0A
     BX = 00  software cursor
         01  hardware cursor
    CX = start of screen mask or hardware cursor scan line
      DX = end of screen mask or hardware cursor scan line


        returns nothing

:int 33,b
^INT 33,B - Read Mouse Motion Counters


      AX = 0B


     on return:
      CX = horizontal mickey count (-32768 to 32767)
      DX = vertical mickey count (-32768 to 32767)


        - count values are 1/200 inch intervals (1/200 in. = 1 mickey)

:int 33,c
^INT 33,C - Set Mouse User Defined Subroutine and Input Mask

     AX = 0C
     ES:DX = far pointer to user interrupt
   CX = user interrupt mask:

      ³F-5³4³3³2³1³0³ user interrupt mask in CX
      ³ ³ ³ ³ ³ ÀÄÄÄ cursor position changed
             ³ ³ ³ ³ ÀÄÄÄÄ left button pressed
          ³ ³ ³ ÀÄÄÄÄÄ left button released
          ³ ³ ÀÄÄÄÄÄÄ right button pressed
           ³ ÀÄÄÄÄÄÄÄ right button released
           ÀÄÄÄÄÄÄÄÄÄ unused

        returns nothing


     - routine at ES:DX is called if an event occurs and the
   corresponding bit specified in user mask is set
   - routine at ES:DX receives parameters in the following
   registers:

          AX = condition mask causing call
    CX = horizontal cursor position
     DX = vertical cursor position
       DI = horizontal counts
      SI = vertical counts
        DS = mouse driver data segment
      BX = button state:

             ³F-2³1³0³
         ³  ³ ÀÄÄÄ left button (1 = pressed)
           ³  ÀÄÄÄÄ right button (1 = pressed)
           ÀÄÄÄÄÄÄ unused

    - initial call mask and user routine should be restore on exit
        from user program
 - user program may need to set DS to it's own segment
      - see   ~INT 33,14~

:int 33,d
^INT 33,D - Mouse Light Pen Emulation On


        AX = 0D


     returns nothing


     - turns on light pen emulation;  the light pen is considered
          down when both buttons are down;   when both buttons are
    up the pen is considered off screen

   - see   ~INT 33,E~

:int 33,e
^INT 33,E - Mouse Light Pen Emulation Off


        AX = 0E


     returns nothing


     - disables light pen emulation

  - see   ~INT 33,D~

:int 33,f
^INT 33,F - Set Mouse Mickey Pixel Ratio


 AX = 0F
     CX = horizontal ratio (1..32767, default 8)
 DX = vertical ratio (1..32767, default 16)


  returns nothing


     - sets the ratio between physical cursor movement (mickeys) and
       screen coordinate changes
 - CX and DX must be unsigned (high bit must be 0)

:int 33,10
^INT 33,10 - Mouse Conditional OFF


       AX = 10h
    CX = upper X screen coordinate
      DX = upper Y screen coordinate
      SI = lower X screen coordinate
      DI = lower Y screen coordinate


      returns nothing


     - defines screen region for updating in which the mouse is hidden
     if found these coordinates (INT 33,1 must be used to turn cursor
        on again)

 - see  ~INT 33,1~

:int 33,13
^INT 33,13 - Set Mouse Double Speed Threshold


    AX = 13h
    DX = threshold speed (mickeys per second, default 64)


       returns nothing


     - cursor speed is doubled when the cursor moves across the screen
     at the threshold speed

:int 33,14
^INT 33,14 - Swap Interrupt Subroutines

       AX = 14h
    ES:DX = far pointer to user routine
     CX = user interrupt mask:

           ³F-8³7³6³5³4³3³2³1³0³ user interrupt mask in CX
             ³  ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄ cursor position changed
           ³  ³ ³ ³ ³ ³ ³ ÀÄÄÄÄ left button pressed
                ³  ³ ³ ³ ³ ³ ÀÄÄÄÄÄ left button released
                ³  ³ ³ ³ ³ ÀÄÄÄÄÄÄ right button pressed
                 ³  ³ ³ ³ ÀÄÄÄÄÄÄÄ right button released
                 ÀÄÄÁÄÁÄÁÄÄÄÄÄÄÄÄ unused

       on return:
      CX = previous user interrupt mask
   ES:DX = far pointer to previous user interrupt

      - routine at ES:DX is called if an event occurs and the
   corresponding bit specified in user mask is set
   - routine at ES:DX receives parameters in the following
   registers:

          AX = condition mask causing call
    CX = horizontal cursor position
     DX = vertical cursor position
       DI = horizontal counts
      SI = vertical counts
        DS = mouse driver data segment
      BX = button state:

             ³F-2³1³0³
         ³  ³ ÀÄÄÄ left button (1 = pressed)
           ³  ÀÄÄÄÄ right button (1 = pressed)
           ÀÄÄÄÄÄÄ unused

    - initial call mask and user routine should be restore on exit
        from user program
 - user program may need to set DS to it's own segment
      - see   ~INT 33,C~

:int 33,15
^INT 33,15 - Get Mouse Driver State and Memory Requirements


     AX = 15h


    on return
   BX = buffer size need to hold current mouse state


   - used before mouse functions 16h and 17h to determine memory
         needed to save mouse state before giving up control of mouse
        to another program

:int 33,16
^INT 33,16 - Save Mouse Driver State


  AX = 16h
    ES:DX = far pointer to mouse state save buffer


  returns nothing


     - used to save mouse information before relinquishing control
         to another programs mouse handler
 - see ~INT 33,15~   ~INT 33,17~

:int 33,17
^INT 33,17 - Restore Mouse Driver State


    AX = 17h
    ES:DX = far pointer to mouse state save buffer


  returns nothing


     - used to restore mouse information after regaining control
   from another programs mouse handler
       - see ~INT 33,15~   ~INT 33,16~

:int 33,18
^INT 33,18 - Set alternate subroutine call mask and address

    AX = 18h
    DX = offset to function
     CX = user interrupt mask:

           ³F-8³7³6³5³4³3³2³1³0³ user interrupt mask in CX
             ³  ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄ alt key pressed during event
              ³  ³ ³ ³ ³ ³ ³ ÀÄÄÄÄ ctrl key pressed during event
              ³  ³ ³ ³ ³ ³ ÀÄÄÄÄÄ shift key pressed during event
              ³  ³ ³ ³ ³ ÀÄÄÄÄÄÄ right button up event
                ³  ³ ³ ³ ÀÄÄÄÄÄÄÄ right button down event
               ³  ³ ³ ÀÄÄÄÄÄÄÄÄ left button up event
           ³  ³ ÀÄÄÄÄÄÄÄÄÄ left button down event
                  ³  ÀÄÄÄÄÄÄÄÄÄÄ cursor moved
             ÀÄÄÄÄÄÄÄÄÄÄÄÄ unused

     - entire mask is set to zero when ~INT 33,0~ is called
      - up to three handlers may be defined with this call
        - mask should be cleared before program exit
        - when handler is called it receives parameters in the following
      registers:

          AX = condition mask causing call
    CX = horizontal cursor position
     DX = vertical cursor position
       DI = horizontal counts
      SI = vertical counts
        DS = mouse driver data segment
      BX = button state:

             ³F-2³1³0³
         ³  ³ ÀÄÄÄ left button (1 = pressed)
           ³  ÀÄÄÄÄ right button (1 = pressed)
           ÀÄÄÄÄÄÄ unused

:int 33,19
^INT 33,19 - Get User Alternate Interrupt Address

 AX = 19h
    CX = user interrupt call mask (see below)


   on return:
      BX:DX = user interrupt vector
   CX = user interrupt call mask or zero if not found

              ³F-8³7³6³5³4³3³2³1³0³ user interrupt mask in CX
             ³  ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄ alt key pressed during event
              ³  ³ ³ ³ ³ ³ ³ ÀÄÄÄÄ ctrl key pressed during event
              ³  ³ ³ ³ ³ ³ ÀÄÄÄÄÄ shift key pressed during event
              ³  ³ ³ ³ ³ ÀÄÄÄÄÄÄ right button up event
                ³  ³ ³ ³ ÀÄÄÄÄÄÄÄ right button down event
               ³  ³ ³ ÀÄÄÄÄÄÄÄÄ left button up event
           ³  ³ ÀÄÄÄÄÄÄÄÄÄ left button down event
                  ³  ÀÄÄÄÄÄÄÄÄÄÄ cursor moved
             ÀÄÄÄÄÄÄÄÄÄÄÄÄ unused

     - returns vector to function defined by ~INT 33,18~
 - searches the event handlers defined by INT 33,18 for a routine
      with a call mask matching CX

:int 33,1a
^INT 33,1A - Set Mouse Sensitivity


  AX = 1A
     BX = horizontal coordinates per pixel  (ó 100)
     CX = vertical coordinates per pixel  (ó 100)
       DX = double speed threshold


 returns nothing


     - sets mouse sensitivity by setting the ratio of the mouse
    coordinates per screen pixel
      - provides same results as calls to both ~INT 33,F~ and ~INT 33,13~
 - these values are not reset by ~INT 33,0~
:int 33,1b
^INT 33,1B - Get Mouse Sensitivity


  AX = 1B


     on return:
      BX = horizontal coordinates per pixel  (ó 100)
     CX = vertical coordinates per pixel  (ó 100)
       DX = double speed threshold


 - returns mouse sensitivity information as the number of mouse
        coordinates per screen pixel

:int 33,1c
^INT 33,1C - Set Mouse Interrupt Rate  (InPort only)


        AX = 1C
     BX = rate code
         = 0  no interrupts
          = 1  30 interrupts per second
       = 2  50 interrupts per second
       = 3  100 interrupts per second
      = 4  200 interrupts per second



       - work with the InPort mouse only
   - sets the rate the mouse status is polled by the mouse driver
      - faster rates provide better resolution but take away CPU time
     - values in BX > 4 can cause unpredicatable results

:int 33,1d
^INT 33,1D - Set Mouse CRT Page


     AX = 1D
     BX = CRT page number


        returns nothing


     - sets the CRT page which the mouse cursor is displayed
     - see ~VIDEO PAGES~

:int 33,1e
^INT 33,1E - Get Mouse CRT Page


        AX = 1E


     on return:
      BX = CRT page number cursor is displayed on


 - see ~VIDEO PAGES~

:int 33,1f
^INT 33,1F - Disable Mouse Driver


      AX = 1F


     on return:
      AX = 001F if successful
          FFFF if error
  ES:BX = previous ~INT 33~ vector


        - restores vectors for ~INT 10~ and INT 71 (8088/86) or INT 74 (286+)
       - ~INT 33~ interrupt vector (software) is not affected
      - use of the vector returned in ES:BX to restore the previous INT 33
      vector can cause problems since it contains the value of INT 33
     before the driver was installed; any other hooks into INT 33 set
    after driver installation will not receive service

:int 33,20
^INT 33,20 - Enable Mouse Driver


      AX = 20h


    returns nothing


     - reinstalls the mouse drivers interrupt vectors for INT 10 and
       INT 71 (8088/86) and INT 74 (286/386)
     - see ~INT 33,1F~

:int 33,21
^INT 33,21 - Reset Mouse Software

    AX = 21h

        on return:
      AX = 0021  mouse driver not installed
            FFFF  mouse driver installed
   BX = 2  mouse driver installed

  - similar to ~INT 33,0~ but does not reset the mouse hardware or
      display variables
 - both AX and BX must be correct for successful reset
       - interrupt routines set through ~INT 33,18~ are preserved
  - resets the mouse to the following defaults:

         .  mouse is positioned to screen center
     .  mouse cursor is reset and hidden
         .  no interrupts are enabled (mask = 0)
     .  double speed threshold set to 64 mickeys per second
      .  horizontal mickey to pixel ratio (8 to 8)
        .  vertical mickey to pixel ratio (16 to 8)
         .  max width and height are set to maximum for video mode

:int 33,22
^INT 33,22 - Set Language for Messages

     AX = 22h
    BX = language number (with /L switch value):
       = 0  English     n/a
        = 1  French      F
          = 2  Dutch       NL
         = 3  German      D
          = 4  Swedish     S
          = 5  Finnish     SF
         = 6  Spanish     E
          = 7  Portuguese  P
          = 8  Italian     I


       returns nothing


     - only works with international version of the mouse driver
 - see   ~INT 33,23~
:int 33,23
^INT 33,23 - Get Language Number

       AX = 23h


    on return:
      BX = language number (with /L switch value):
       = 0  English     n/a
        = 1  French      F
          = 2  Dutch       NL
         = 3  German      D
          = 4  Swedish     S
          = 5  Finnish     SF
         = 6  Spanish     E
          = 7  Portuguese  P
          = 8  Italian     I

   - only works with international version of the mouse driver
 - returns English (0) if not international version

      - see   ~INT 33,22~
:int 33,24
^INT 33,24 - Get Driver Version, Mouse Type & IRQ Number

   AX = 24h


    on return:
      BH = major version (see below)
      BL = minor version (see below)
      CH = mouse type:
           = 1  bus mouse
      = 2  serial mouse
           = 3  InPort mouse
           = 4  PS/2  mouse
    = 5  Hewlett Packard mouse
       CL = IRQ number:
           = 0  PS/2
           = 2  ~IRQ~ 2
        = 5  IRQ 5
          = 7  IRQ 7

   - version 6.1 would be represented as BH = 06h, BL = 10h
    

how to use software int is not to explain to an asm coder.
just set different registers to desired values, int 33h, returns the right values.

important note:
int 33h doesn't work very well under winXP
particularilly functions 2, 7 & 8, set mouse position, set X resolution, set Y resolution. oh gosh!!!
Post 22 Nov 2007, 22:41
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1391
Location: Piraeus, Greece
Picnic 24 Nov 2007, 00:52
A lot of mouse info! i'm saving this text edfed.

_________________
Hobby BASIC Interpreter
Post 24 Nov 2007, 00:52
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1391
Location: Piraeus, Greece
Picnic 25 Nov 2007, 16:22
Here is a simple script to show the mouse x,y coords on Windows xp console text mode, works better on full screen.
I don't know about real dos


Code:
   org 100h
    
    mov ax,3             ; text mode        
    int 10h
     
    xor ax,ax             ; mouse initialization
        int 33h   
  
    cmp ax,0             ;  0 = no mouse installed
      jz nomouse      
    
    mov ax,1             ; show mouse
   int 33h
     
main:
       xor bh,bh            ; page 0, cursor position 0,0
  xor dx,dx
   mov ah,2
    int 10h 
            
    mov ax,3            ; get mouse position cx = x, dx = y
     int 33h               ; mouse buttons: left bx = 1, right bx = 2, both bx = 3       
    
    shr cx,3              ; divide by 8 for 80x25 screen
        shr dx,3 
   
    cmp bx,1             ; mouse down?
  jz exit
     
    push dx               ; save y
      mov ax,cx            ; print x
      call dispnum
        mov al,','
        int 29h
     pop ax                ; pop y
       call dispnum         ; print y
      mov al,' '
        int 29h
     int 29h
        jmp main              
   
    mov ax,2              ; hide mouse
  int 33h
     jmp exit             
       
nomouse:
    ; display no mouse message
      
exit:
   int 20h                 ; exit program
      
    
dispnum:                                                      
      mov cx,10             ; print ax number in decimal
dn:
       xor dx,dx
   div cx
      push dx
     or ax,ax
    jz @f
       call dn
@@:
  pop dx
      add dl,30h
  mov ah,2
    int 21h
     ret
    

_________________
Hobby BASIC Interpreter
Post 25 Nov 2007, 16:22
View user's profile Send private message Visit poster's website Reply with quote
xspeed



Joined: 16 Aug 2007
Posts: 22
xspeed 06 Dec 2007, 00:41
my bad


Last edited by xspeed on 06 Dec 2007, 02:52; edited 1 time in total
Post 06 Dec 2007, 00:41
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 06 Dec 2007, 01:00
xspeed, such really big post is needed? Please edit it posting a link instead or remove all the data that has nothing to do with mouse handling (nearly 100%)
Post 06 Dec 2007, 01:00
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4347
Location: Now
edfed 06 Dec 2007, 11:08
Code:
....
;this is to update the mouse datas.
      mov esi,m
      mov eax,[esi+item.call]
      or eax,eax
      je @f     ;if eax=0, carry=0
      call eax ;else, return carry=1 
@@:
     
....
;this is the mouse function, here for DOS.
mouse:
;[esi] => m item 
      push esi
;;;;;;;;;;;;;;
      xor ecx,ecx   ;section DOS dependant
      xor edx,edx
      mov ax,3      
      int 33h         ;with DOS int 33h
;if no mouse installed, cx=0 dx=0 bl=0
;;;;;;;;;;;;;;
      mov [esi+m.x],ecx   ;resolution=640
      mov [esi+m.y],edx   ;resolution=200
      mov bh,[esi+m.status]  ;status buffer
      mov [esi+m.status],bx
      mov ax,bx
      and ax,0101h
      sub al,ah
      shr bx,1
      and bx,0101h      
      sub bl,bh
      mov [esi+m.leftedge],al   
      mov [esi+m.rightedge],bl  
      stc   ;mouse OK!  
      ret      
m:
.call=0
.x=4
.y=8
.status=12
.leftedge=14
.rightedge=15
align 8
dd mouse,0,0,0
    
Post 06 Dec 2007, 11:08
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.