Merge remaining files

This commit is contained in:
twinaphex 2017-07-26 00:11:14 +02:00
parent b2127cfbbe
commit b744bde2e7
2 changed files with 20 additions and 20 deletions

View File

@ -1,8 +1,8 @@
/***************************************************************************************
* Genesis Plus
* Sega Mouse support
* Sega/Mega Mouse support
*
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2017 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@ -113,15 +113,15 @@ unsigned char mouse_read()
/* TL = busy status */
if (mouse.Wait)
{
/* wait before ACK, fix some buggy mouse routine (Cannon Fodder, Shangai 2, Wack World,...) */
mouse.Wait = 0;
/* wait before acknowledging handshake request */
mouse.Wait--;
/* TL = !TR */
temp |= (~mouse.State & 0x20) >> 1;
/* TL = !TR (handshake in progress) */
temp |= (~mouse.State & 0x20) >> 1;;
}
else
{
/* TL = TR (data is ready) */
/* TL = TR (handshake completed) */
temp |= (mouse.State & 0x20) >> 1;
}
@ -133,25 +133,25 @@ void mouse_write(unsigned char data, unsigned char mask)
/* update bits set as output only */
data = (mouse.State & ~mask) | (data & mask);
/* TH transition */
if ((mouse.State ^ data) & 0x40)
{
/* start (TH=0) or stop (TH=1) acquisition */
mouse.Counter = 1 - ((data & 0x40) >> 6);
}
/* TR transition */
if ((mouse.State ^ data) & 0x20)
{
/* acquisition in progress */
if ((mouse.Counter > 0) && (mouse.Counter < 10))
/* check if acquisition is started */
if ((mouse.Counter > 0) && (mouse.Counter < 9))
{
/* increment phase */
mouse.Counter++;
}
/* TL handshake latency */
mouse.Wait = 1;
/* TL handshake latency (fix buggy mouse routine in Cannon Fodder, Shangai 2, Wacky World, Star Blade, ...) */
mouse.Wait = 2;
}
/* TH transition */
if ((mouse.State ^ data) & 0x40)
{
/* start (TH=1->0) or stop (TH=0->1) data acquisition */
mouse.Counter = (mouse.State >> 6) & 1;
}
/* update internal state */

View File

@ -1,8 +1,8 @@
/***************************************************************************************
* Genesis Plus
* Sega Mouse support
* Sega/Mega Mouse support
*
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2017 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met: