[comp.windows.ms] Mouse on Com3??

shedevil@portia.Stanford.EDU (Anne Prisk) (09/09/90)

I have the ms mouse that came bundled with my windows 3.0.  I really
need to run it on Com3, and can't find a way to do it with the docs.
Maybe I'm just missing it in the book...I'm not particularly savvy.
Any help/ideas??

Thanks.

Annie

-- 
<*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*>
   Anne (She Devil) Mitchell - Stanford Law - BBS: 415-497-5291,1200,N,8,1
    No disclaimer necessary as this is *my* account, and besides - nobody
       would ever accuse anyone else of having these opinions anyway!

otto@tukki.jyu.fi (Otto J. Makela) (09/11/90)

In article <1990Sep8.225702.6638@portia.Stanford.EDU> shedevil@portia.Stanford.EDU (Anne Prisk) writes:
   I have the ms mouse that came bundled with my windows 3.0.  I really
   need to run it on Com3, and can't find a way to do it with the docs.

I already posted this once, but it seemed to get lost amongst other
articles... hope this helps !

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 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

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 <otto@jyu.fi> * * * * * * * * * * * * * * * * * * * * *
* Phone: +358 41 613 847, BBS: +358 41 211 562 (CCITT, Bell 2400/1200/300) *
* Mail: Kauppakatu 1 B 18, SF-40100 Jyvaskyla, Finland, EUROPE             *
* * * Computers Rule 01001111 01001011 * * * * * * * * * * * * * * * * * * *

rogerson@PEDEV.Columbia.NCR.COM (Dale Rogerson) (09/12/90)

In article <1990Sep8.225702.6638@portia.Stanford.EDU> shedevil@portia.Stanford.EDU (Anne Prisk) writes:
>I have the ms mouse that came bundled with my windows 3.0.  I really
>need to run it on Com3, and can't find a way to do it with the docs.
>Maybe I'm just missing it in the book...I'm not particularly savvy.
>Any help/ideas??
	
	My manual states that a mouse can ONLY be used on com1 or com2.
	So I think that you will have to rearrange your com ports to make
	it work.

	-----Dale
		Rogerson----

etxsral@tnetxa.ericsson.se (Lars Nilsson, ERICSSON TELECOM, SWEDEN) (09/15/90)

In article <OTTO.90Sep11085117@tukki.jyu.fi>, otto@tukki.jyu.fi (Otto J. Makela) writes:

> 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

My computer uses IRQ 10/IRQ 11 for COM3/COM4.
Is it still possible to patch the mouse.drv ?

----
Lars Nilsson        
Ericsson Telecom AB , Sweden
Phone: + 46 (8) 719 7308
Fax:   + 46 (8) 645 60 76

INTERNET: etxsral@tnetxa.ericsson.se
FIDONET : Lars Nilsson at 2:201/108.7

Ericsson Corporate Network: VAX-MAIL: TNETXA::ETXSRAL 
                                      MEMO: ERI.ETX.ETXSRAL
                                      IBM : ETXSRAL at LMEL
                                            ETXSRAL at LMES