home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / ibm / pc / misc / 14948 < prev    next >
Encoding:
Internet Message Format  |  1992-11-24  |  6.6 KB

  1. Xref: sparky comp.sys.ibm.pc.misc:14948 sfnet.atk.ms-dos:761
  2. Path: sparky!uunet!mcsun!news.funet.fi!network.jyu.fi!jybox!otto
  3. From: otto@jybox.jyu.fi (Otto J. Makela)
  4. Newsgroups: comp.sys.ibm.pc.misc,sfnet.atk.ms-dos
  5. Subject: Re: Windows cannot find my mouse?
  6. Message-ID: <67sPuB2w165w@jybox.jyu.fi>
  7. Date: Tue, 24 Nov 92 01:17:04 EET
  8. References: <1992Nov23.161334.13831@abo.fi>
  9. Organization: Jyvaskyla Electronic Mailbox
  10. Lines: 130
  11.  
  12. MSUORANTA@FINABO.ABO.FI (Mika Suoranta Tkkk) writes:
  13.  
  14. >         MY WINDOWS DOES NOT FIND MY MOUSE!
  15. >  
  16. >         My com-ports are:
  17. >         COM 1 address 3F8, irq 4   an extra printer, has to be in
  18. >                                    com 1 or 2
  19. >         COM 2         2F8  irq 3   modem, must be in com 1 or 2
  20. >         COM 3         3E8  irq 4   mouse
  21. >         COM 4         2E8  irq 3   ham radio packet modem
  22.  
  23. Tuff luck, Windows only supports mice in COM1 or COM2.  But don't despair,
  24. I wrote this some time ago...
  25. --
  26. Patching Windows 3.0/3.1 for serial MicroSoft Mouse in other than COM1 or COM2
  27. ==============================================================================
  28.  
  29. I recently was faced with the problem of needing the use of both COM1 and
  30. COM2 under Windows3, thus being unable to plug my MicroSoft Mouse compatible
  31. serial trackball into either of these ports.  Unfortunately, the driver
  32. supplied with Windows3 supports only these ports.  I asked around on the
  33. net, but no-one seemed to know; thus, I decided to figure out a way to patch
  34. Windows3 to make it possible to use a non-standard address of COM port.
  35. Here are my results, hopefully someone else will find them useful.
  36.  
  37. First, you need Windows3 installed normally, with the MicroSoft serial Mouse
  38. driver MOUSE.DRV residing in the SYSTEM subdirectory under wherever you
  39. installed Windows3.   Make a backup copy of it and load it into debug or your
  40. favorite debugger/binary patcher.
  41.  
  42. Windows 3.0
  43. -----------
  44.  
  45. At the file offset 82Ch you will find the following table (the offsets shown
  46. here differ by 100h, since debug loads all files with a 256-byte PSP):
  47.  
  48. -d92c,935
  49. 25A9:0920                                      F8 02 0B F7
  50. 25A9:0930  F8 03 0C EF 00 00
  51.  
  52. The structure of this table is as follows: each of the two entrys in it is
  53. four bytes, with the 8250 serial chip port address as the first word (bytes
  54. reversed, naturally) and the interrupt vector number and 8259A interrupt
  55. controller mask following that.  The last zero word is a table terminator
  56. (thus, there are probably plans for expanding this table in the future).
  57. So, this standard table encodes the following ports for mouse usage:
  58.     Port    Addr    Intvect    (IRQ)    Mask
  59.     COM2    02F8h    0Bh    3    F7h=11110111b
  60.     COM1    03F8h    0Ch    4    EFh=11101111b
  61.  
  62. The IRQ line number can be calculated simply from the interrupt vector number
  63. by substracting 8 (remember, the first hardware interrupt is timer0 on IRQ0,
  64. which produces interrupt 8).  The 8259A interrupt controller mask could
  65. actually also be simply calculated from the IRQ by shifting one left IRQ#
  66. bits and doing a logical not to the result; seems that a programmer at
  67. MicroSoft felt that it's easier to do it this way.
  68.  
  69. Now, to patch your own values into this table, you need to know the same
  70. things about the COM port which you intend to use as your mouse port: the
  71. 8250 chip address and the interrupt it generates.
  72.  
  73. For your convinience, here are two common methods of arranging COM3 and COM4:
  74.     COM3    03E8h    0Ch    4    EFh=11101111b
  75.     COM4    02E8h    0Bh    3    F7h=11110111b
  76. Also, COM3/COM4 sometimes (I believe on the PS/2, but why would you have a
  77. MicroSoft serial mouse there anyway ?) share IRQ5, which has a interrupt
  78. vector of 0Dh and mask of  DFh=11011111b.  Also IRQ2 is sometimes used
  79. (vector 0Ah, mask FBh=11111011b); on the PC/AT IRQ2 actually generates a
  80. IRQ9 on the bus, but you needn't worry about that since DOS will take care
  81. of generating an interrupt 0Ah and acknowledging the actully generated IRQ
  82. for you automagically.
  83.  
  84. As an example, let's say you have a weirdo COM card (like the one I have)
  85. which has the 8250 hidden away at 0238h and  which generates IRQ5.  Then
  86. you'd patch the table to read (I decided to sacrafice COM2 capability, you
  87. could also patch over the second, COM1 entry):
  88. -d92c,935
  89. 25A9:0920                                      38 02 0D DF
  90. 25A9:0930  F8 03 0C EF 00 00
  91.  
  92. Windows 3.1
  93. -----------
  94.  
  95. The situation with Windows 3.1 is slightly different.  There is a similar table,
  96. but it is at a different offset (6CAh) and there is a one-byte extra marker:
  97. -d7ca,7d5
  98. 1964:07C0                                38 02 0D DF 02 F8
  99. 1964:07D0  03 0C EF 01 00 00
  100.  
  101. This is simple to patch in a similar way.  I'm not sure if the extra marker is
  102. the port number for 386-Windows port conflict check (anyone know good ways to
  103. verify if this is so ?), if it is, it too should perhaps be patched to reflect
  104. the port in use.
  105.  
  106. Won't Work ?
  107. ------------
  108.  
  109. If you patch incorrectly, one of three things may happen: the mouse cursor is
  110. dead on entry to Windows3 (probably wrong IRQ/mask, use ALT/F4 to get out of
  111. Windows), the mouse can't be seen at all (probably wrong 8250 address, quit
  112. again with ALT/F4) or Windows3 will quit immediately upon entry (you probably
  113. screwed up something else).  Restoring your backup copy of MOUSE.DRV (you did
  114. make it, now didn't you ?) will of course restore functionality.
  115.  
  116. Also be sure you don't have anything else using the same IRQ before you
  117. reconfigure your COM card to free up COM1 or COM2 -- the standard ISA
  118. architecture can't share IRQ lines.
  119.  
  120. It seems that the LogiTech mouse driver is very similar in that there is the
  121. equivalent table which can be patched in the same way.  I haven't done it,
  122. though, so I can't say very much about it.  I've also been asked about ports
  123. with IRQ number greater than 8 (that is, AT style cascaded interrupts), but
  124. I'm afraid I can't say very much about those either, except that theoretically
  125. it should be possible to change these but that would involve changing all the
  126. IN/OUT instructions handling the interrupt controller in the mouse driver.
  127. Want to be the first to find out ?
  128.  
  129. If you did not understand the above instructions, DON'T TRY IT !  Find someone
  130. who does understand.  I of course can't take any responsibility for what
  131. happens to your computer if you follow these instructions :-)
  132.  
  133. Happy Hacking!
  134. Otto Makela <otto@jyu.fi>, Jyvaskyla, Finland, Europe
  135. Call JyBox BBS, +358 41 211 562 (24h/d, CCITT V.22bis/V.22/V.21 Bell 212A/103)
  136.  
  137.  
  138.    /* * * Otto J. Makela <otto@jybox.jyu.fi> * * * * * * * * * * * * * * * */
  139.   /* Phone: +358 41 613 847, BBS: +358 41 211 562 (V.32bis/USR-HST,24h/d) */
  140.  /* Mail: Kauppakatu 1B18/SF-40100 Jyvaskyla/Finland, ICBM: 62.14N25.44E */
  141. /* * * Computers Rule 01001111 01001011 * * * * * * * * * * * * * * * * */
  142.