Thought I would look at the Sega Megatech driver seeing as Haze is on vacation, and I thought it would be a good learning experience to look at its BIOS (and the Z80 is the CPU I know fairly well).
Disabled the reading on the Genesis ports when a certain bit port is set low. Not sure of the correctness, as it is activated when the BIOS goes into test mode. But maybe that's normal. I don't really know for sure.
Also, changed the DIP switch defaults to 1 coin/1 credit for slots 1, 3, and 4, and 1 coin/2 credits for slot 2, at 3 minutes per credit.
In genesis_io_r add these two lines at 1217 & 1239:
if(iport1 & 0x10 || iport2 & 0x20)
return_value+=1;
full code:
READ16_HANDLER ( genesis_io_r )
{
/* 8-bit only, data is mirrored in both halves */
UINT8 return_value = 0;
switch (offset)
{
case 0:
/* Charles MacDonald ( http://cgfm2.emuviews.com/ )
D7 : Console is 1= Export (USA, Europe, etc.) 0= Domestic (Japan)
D6 : Video type is 1= PAL, 0= NTSC
D5 : Sega CD unit is 1= not present, 0= connected.
D4 : Unused (always returns zero)
D3 : Bit 3 of version number
D2 : Bit 2 of version number
D1 : Bit 1 of version number
D0 : Bit 0 of version number
*/
return_value = 0x80; /* ? megatech is usa? */
break;
case 1: /* port A data (joypad 1) */
if (genesis_io_ram[offset] & 0x40)
{
int iport = readinputport(9);
return_value = iport & 0x3f;
}
else
{
int iport1 = readinputport(12);
int iport2 = readinputport(7) >> 1;
return_value = (iport1 & 0x10) + (iport2 & 0x20);
if(iport1 & 0x10 || iport2 & 0x20)
return_value+=1;
}
return_value = (genesis_io_ram[offset] & 0x80) | return_value;
logerror ("reading joypad 1 , type %02x %02x\n",genesis_io_ram[offset] & 0x80, return_value &0x7f);
if(bios_ctrl_inputs & 0x04) return_value = 0xff;
break;
case 2: /* port B data (joypad 1) */
if (genesis_io_ram[offset] & 0x40)
{
int iport1 = (readinputport(9) & 0xc0) >> 6;
int iport2 = (readinputport(8) & 0x0f) << 2;
return_value = (iport1 + iport2) & 0x3f;
}
else
{
int iport1 = readinputport(12) << 2;
int iport2 = readinputport(7) >> 2;
return_value = (iport1 & 0x10) + (iport2 & 0x20);
if(iport1 & 0x10 || iport2 & 0x20)
return_value+=1;
}
return_value = (genesis_io_ram[offset] & 0x80) | return_value;
logerror ("reading joypad 2 , type %02x %02x\n",genesis_io_ram[offset] & 0x80, return_value &0x7f);
if(bios_ctrl_inputs & 0x04) return_value = 0xff;
break;
default:
return_value = 0xe0;
}
return return_value | return_value << 8;
}
This will fix the Golden Axe 2 start recognition bug.This is a guess,but I believe that bit is used for "joypad recognition",because without it the xP Play msg doesn't appear in the Main menu screen...
This will fix *at least* Gain Ground as well if a MegaTech version exists at all(I remember it can recognize "joypad recognition"),but I'm unsure if it breaks something at all(Needs through testing).