Article View: comp.sys.ibm.pc.misc
Article #10617Re: Windows cannot find my mouse?
From: Otto J. Makela
Date: Mon, 23 Nov 1992 23:17
Date: Mon, 23 Nov 1992 23:17
130 lines
6816 bytes
6816 bytes
MSUORANTA@FINABO.ABO.FI (Mika Suoranta Tkkk) writes: > MY WINDOWS DOES NOT FIND MY MOUSE! > > My com-ports are: > COM 1 address 3F8, irq 4 an extra printer, has to be in > com 1 or 2 > COM 2 2F8 irq 3 modem, must be in com 1 or 2 > COM 3 3E8 irq 4 mouse > COM 4 2E8 irq 3 ham radio packet modem Tuff luck, Windows only supports mice in COM1 or COM2. But don't despair, I wrote this some time ago... -- Patching Windows 3.0/3.1 for serial MicroSoft Mouse in other than COM1 or COM2 ============================================================================== I recently was faced with the problem of needing the use of both COM1 and COM2 under Windows3, thus being unable to plug my MicroSoft Mouse compatible serial trackball into either of these ports. Unfortunately, the driver supplied with Windows3 supports only these ports. I asked around on the net, but no-one seemed to know; thus, I decided to figure out a way to patch Windows3 to make it possible to use a non-standard address of COM port. Here are my results, hopefully someone else will find them useful. First, you need Windows3 installed normally, with the MicroSoft serial Mouse driver MOUSE.DRV residing in the SYSTEM subdirectory under wherever you installed Windows3. Make a backup copy of it and load it into debug or your favorite debugger/binary patcher. Windows 3.0 ----------- At the file offset 82Ch you will find the following table (the offsets shown here differ by 100h, since debug loads all files with a 256-byte PSP): -d92c,935 25A9:0920 F8 02 0B F7 25A9:0930 F8 03 0C EF 00 00 The structure of this table is as follows: each of the two entrys in it is four bytes, with the 8250 serial chip port address as the first word (bytes reversed, naturally) and the interrupt vector number and 8259A interrupt controller mask following that. The last zero word is a table terminator (thus, there are probably plans for expanding this table in the future). So, this standard table encodes the following ports for mouse usage: Port Addr Intvect (IRQ) Mask COM2 02F8h 0Bh 3 F7h=11110111b COM1 03F8h 0Ch 4 EFh=11101111b The IRQ line number can be calculated simply from the interrupt vector number by substracting 8 (remember, the first hardware interrupt is timer0 on IRQ0, which produces interrupt 8). The 8259A interrupt controller mask could actually also be simply calculated from the IRQ by shifting one left IRQ# bits and doing a logical not to the result; seems that a programmer at MicroSoft felt that it's easier to do it this way. Now, to patch your own values into this table, you need to know the same things about the COM port which you intend to use as your mouse port: the 8250 chip address and the interrupt it generates. For your convinience, here are two common methods of arranging COM3 and COM4: COM3 03E8h 0Ch 4 EFh=11101111b COM4 02E8h 0Bh 3 F7h=11110111b Also, COM3/COM4 sometimes (I believe on the PS/2, but why would you have a MicroSoft serial mouse there anyway ?) share IRQ5, which has a interrupt vector of 0Dh and mask of DFh=11011111b. Also IRQ2 is sometimes used (vector 0Ah, mask FBh=11111011b); on the PC/AT IRQ2 actually generates a IRQ9 on the bus, but you needn't worry about that since DOS will take care of generating an interrupt 0Ah and acknowledging the actully generated IRQ for you automagically. As an example, let's say you have a weirdo COM card (like the one I have) which has the 8250 hidden away at 0238h and which generates IRQ5. Then you'd patch the table to read (I decided to sacrafice COM2 capability, you could also patch over the second, COM1 entry): -d92c,935 25A9:0920 38 02 0D DF 25A9:0930 F8 03 0C EF 00 00 Windows 3.1 ----------- The situation with Windows 3.1 is slightly different. There is a similar table, but it is at a different offset (6CAh) and there is a one-byte extra marker: -d7ca,7d5 1964:07C0 38 02 0D DF 02 F8 1964:07D0 03 0C EF 01 00 00 This is simple to patch in a similar way. I'm not sure if the extra marker is the port number for 386-Windows port conflict check (anyone know good ways to verify if this is so ?), if it is, it too should perhaps be patched to reflect the port in use. Won't Work ? ------------ If you patch incorrectly, one of three things may happen: the mouse cursor is dead on entry to Windows3 (probably wrong IRQ/mask, use ALT/F4 to get out of Windows), the mouse can't be seen at all (probably wrong 8250 address, quit again with ALT/F4) or Windows3 will quit immediately upon entry (you probably screwed up something else). Restoring your backup copy of MOUSE.DRV (you did make it, now didn't you ?) will of course restore functionality. Also be sure you don't have anything else using the same IRQ before you reconfigure your COM card to free up COM1 or COM2 -- the standard ISA architecture can't share IRQ lines. It seems that the LogiTech mouse driver is very similar in that there is the equivalent table which can be patched in the same way. I haven't done it, though, so I can't say very much about it. I've also been asked about ports with IRQ number greater than 8 (that is, AT style cascaded interrupts), but I'm afraid I can't say very much about those either, except that theoretically it should be possible to change these but that would involve changing all the IN/OUT instructions handling the interrupt controller in the mouse driver. Want to be the first to find out ? If you did not understand the above instructions, DON'T TRY IT ! Find someone who does understand. I of course can't take any responsibility for what happens to your computer if you follow these instructions :-) Happy Hacking! Otto Makela <otto@jyu.fi>, Jyvaskyla, Finland, Europe Call JyBox BBS, +358 41 211 562 (24h/d, CCITT V.22bis/V.22/V.21 Bell 212A/103) /* * * Otto J. Makela <otto@jybox.jyu.fi> * * * * * * * * * * * * * * * */ /* Phone: +358 41 613 847, BBS: +358 41 211 562 (V.32bis/USR-HST,24h/d) */ /* Mail: Kauppakatu 1B18/SF-40100 Jyvaskyla/Finland, ICBM: 62.14N25.44E */ /* * * Computers Rule 01001111 01001011 * * * * * * * * * * * * * * * * */
Technical Details
Message-ID:
<67sPuB2w165w@jybox.jyu.fi>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!news.funet.fi!network.jyu.fi!jybox!ottoReferences:
<1992Nov23.161334.13831@abo.fi>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!news.funet.fi!network.jyu.fi!jybox!otto From: otto@jybox.jyu.fi (Otto J. Makela) Newsgroups: comp.sys.ibm.pc.misc,sfnet.atk.ms-dos Subject: Re: Windows cannot find my mouse? Message-ID: <67sPuB2w165w@jybox.jyu.fi> Date: Tue, 24 Nov 92 01:17:04 EET References: <1992Nov23.161334.13831@abo.fi> Organization: Jyvaskyla Electronic Mailbox Lines: 130