About using the mouse on other than COM1 or COM2, something I wrote... Patching Windows3 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. 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 sacrifice 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 If you patch it 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. 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 J. Makela * * * * * * * * * * * * * * * * * * */ /* Phone: +358 41 613 847, BBS: +358 41 211 562 (USR HST/V.32, 24h/d) */ /* Mail: Kauppakatu 1 B 18, SF-40100 Jyvaskyla, Finland, EUROPE */ /* * * Computers Rule 01001111 01001011 * * * * * * * * * * * * * * * * */