A question about Sega Mouse

For anything related to IO (joypad, serial, XE...)

Moderator: BigEvilCorporation

Post Reply
User avatar
HCKTROX
Interested
Posts: 27
Joined: Wed Mar 24, 2010 1:15 am
Location: Chile

A question about Sega Mouse

Post by HCKTROX » Wed Oct 29, 2014 6:14 pm

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!
skype: hcktrox

Chilly Willy
Very interested
Posts: 2558
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Wed Oct 29, 2014 7:28 pm

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

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest