Page 1 of 1

A question about Sega Mouse

Posted: Wed Oct 29, 2014 6:14 pm
by HCKTROX
Hello.

It's been since February I've been trying to do built-in editors for a project I'm working on, and since always I felt the urge to get the Sega Mouse working for easier usage of interface.
Until now, I've already put a joypad-controlled "mouse cursor", but I guess it's enough time to get it to work how intended. I've been following this, but not only I'm completely unable to understand the technical first description, but I'm also unable to finish installing because of the last code being written in C; - Perhaps I'm too overheaded - but I can't understand nearly a single line from that code.

May you give me a better explanation about either the C code or tech text? Thank you!

Posted: Wed Oct 29, 2014 7:28 pm
by Chilly Willy
Look at joy.c in the sgdk source for C code on reading the mouse.

Note: Since working with gaseag68k with the mouse code on his Wolf3D MD port, we've learned that the only difference between the JP/EU mouse and the MegaMouse is a lack of the middle mouse button and START, and that you can get -0 for x and y, which should be converted into -1.

The -0 can be fixed by changing these lines

Code: Select all

            if (md[0] & 0x01)
                mx |= 0xFF00; /* x sign extend */
...
            if (md[0] & 0x02)
                my |= 0xFF00; /* y sign extend */
to this

Code: Select all

            if (md[0] & 0x01)
                mx = mx ? mx | 0xFF00 : -1; /* x sign extend */
...
            if (md[0] & 0x02)
                my = my ? my| 0xFF00 : -1; /* y sign extend */