News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Handling mouse

Started by zak100, December 31, 2009, 05:30:56 PM

Previous topic - Next topic

zak100

Hi,
How can I handle mouse using BIOS routines? I found that normally int 33h is used which is dos interrupt. I am not able to find a BIOS based method for using mouse.

Zulfi.

dedndave

well - i am not sure INT 33h is actually a DOS interrupt (DOS interrupts are traditionally 20h-2Fh)
in the early days of mice, it was added by way of a device driver in the CONFIG.SYS file, or in a TSR program
the problem you are going to have is supporting a variety of mouse interfaces
but, it is one of the many things you must support to get things going
you can get started with keyboard only and add mouse support later
but, you are going to bump into similar issues with graphics adapters, drives, wireless keyboards, printers, and so on
that's all part of writing an OS   :bg

MichaelW

You could try the CuteMouse mouse driver, or use the source to help you develop your own.
eschew obfuscation

FORTRANS

Hi,

   Int 33H is the normal DOS divice driver interface.  Int 15H
function C2H is used by some BIOSes to drive a built in mouse
port.  "Undocumented DOS" shows these as subfunctions for
the IBM PS/1 and newer..


AH = C2H  Int 15 BIOS function

AL  Subfunction
0,  BH = 0  Disable mouse
0,  BH = 1  Enable mouse
1,          Reset mouse
2,          Set sample rate
3,          Set resolution
4,          Get device ID
5,          Initialize mouse
6,  BH = 0  Return status
6,  BH = 1  Set scaling factor to 1:1
6,  BH = 2  Set scaling factor to  2:1
7,          Set mouse handler address (device driver to update)


   "Undocumented DOS" can be considered an old copy of
Ralf Brown's Interrupt List in some ways, so look at it for
more recent information.

Regards,

Steve N.

zak100


MichaelW

AFAIK these functions are not supported by most systems. I think the only system I ever tested that did support these functions was a PS/1 (with an 8086 processor, to give you an idea of how far back this was). For my 10 year-old primary system the functions returned with the carry flag set and 86h in AH (not implemented).
eschew obfuscation

FORTRANS

Hi,

   Good to know.  They were not well liked by the author
by the way.  I guess I should set up RBIL again to see
what's been updated.  Reading further in Undoc seems to
imply they don't save all that much programming anyway.
Just gets rid of hardware specifics.

Regards,

Steve N.

FORTRANS

Oh dear,

   Tried it out on my PIII.  Running Windows, it generates a
carry and 86 in AH (not implemented).  Reboot to a different
operating system, and in its DOS box it returns what appear
to be valid status bytes.  Drat, now I have to look at more
than one machine.

Cheers,

Steve

dedndave

i think those are actually BIOS functions, but are disabled with newer OS's

zak100

Hi,
I have downloaded the cutemouse. I want to install it  using  my self made OS. Any ideas in this regard.

Zulfi.

dedndave

it uses DOS INT's - you have to write enough of an OS to support it
it installs itself as a TSR - you need an EXEC loader function
i see INT 29h - fast console output function
there are probably others

another approach is to look at the source and see how they communicate with different types of mouse
then, write your own driver from there, or write it into your OS - i.e. use it as a learning tool

sinsi

From what I remember about the BIOS mouse function, if you have a ps/2 mouse connected on boot it will work otherwise you take an error as having no ps/2 mouse.
The microsoft mouse driver (version 10) will use the functions if it gets no error on its driver init.
Light travels faster than sound, that's why some people seem bright until you hear them.

dedndave

once you figure out how to communicate with a PS/2 mouse, a serial mouse,
and a USB mouse, i would think it would be an easy driver to write

looking at the cutemouse driver, it looks like there is more code involved installing it as a TSR - lol

if you think the mouse is hard, wait til you get to the video adapters and hard drives   :bg

sinsi

serial mouse - easy, it's just a com port
ps/2 mouse - a bit harder since it uses the keyboard controller (but uses a different irq), but you can easily include a keyboard driver as a bonus
usb mouse - unless you tell the bios to use legacy kbd+mouse (ps/2 usually), you need a usb driver - 2 different v1 usb, enhanced usb (v2) and the new one.
You can see why OS's usually separate the hardware driver and the keyboard driver.

I downloaded a dos driver for usb - 90KB and 66KB as a tsr - usb is complex for the sake of 1 device...

Video adapter - use vesa
Hard drive - IDE/ATAPI is fairly easy since it's a standard. SATA means talking to a pci bus, hard (unless (once again) the bios is configured right).
Light travels faster than sound, that's why some people seem bright until you hear them.

dedndave

Sinsi - Zulfi is trying to write his own little OS
he cannot load a vesa driver   :bg
at this point, he can't really "load" anything - well - no EXEC loader
he has gotten as far as booting a floppy and loading a small program that displays the time
you are right, though
as long as he uses a PS/2 or serial mouse, things are pretty simple
a USB mouse is a little more work