mirror of
https://github.com/holub/mame
synced 2025-06-30 16:00:01 +03:00
(MESS) sms.c: fixed behavior of the TH pin in the Japanese SMS consoles. [Enik Land]
This commit is contained in:
parent
3ed8f2473a
commit
fdc538eb29
@ -21,6 +21,16 @@
|
||||
- Emulate SRAM cartridges? (for use with Bock's dump tool)
|
||||
- Support for other DE-9 compatible controllers, like the Mega Drive 6-Button
|
||||
that has software support (at least a test tool made by Charles MacDonald)
|
||||
- Figure out how korean SMS versions have support for the Light Phaser gun
|
||||
|
||||
Light Phaser support of korean SMS consoles is shown in some korean adverts:
|
||||
www.smspower.org/forums/viewtopic.php?p=45903#45903
|
||||
The support requires read of TH input state through the 2 upper bits of
|
||||
port $dd. Because the korean driver is set to Japan region, it behaves like
|
||||
the japanese SMS, which sets those bits with TH direction state, not input.
|
||||
The first korean SMS is derivered from the japanese SMS, but only the units
|
||||
with plug-in AC adaptor have the FM chip. Games only play FM sound when detect
|
||||
the japanese region by testing how the 2 upper bits of port $dd behave.
|
||||
|
||||
The Game Gear SIO hardware is not emulated but has some
|
||||
placeholders in 'machine/sms.c'
|
||||
@ -757,6 +767,14 @@ static MACHINE_CONFIG_DERIVED( sms_fm, sms1_ntsc )
|
||||
MCFG_CPU_MODIFY("maincpu")
|
||||
MCFG_CPU_IO_MAP(smsj_io)
|
||||
|
||||
// Mark III does not have TH connected. Also, according with Enri's docs
|
||||
// (http://www43.tok2.com/home/cmpslv/Sms/EnrSms.htm), the Japanese SMS
|
||||
// only allows read of TH direction, through port $dd, not its input state.
|
||||
MCFG_SMS_CONTROL_PORT_MODIFY(CONTROL1_TAG)
|
||||
MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(NULL)
|
||||
MCFG_SMS_CONTROL_PORT_MODIFY(CONTROL2_TAG)
|
||||
MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(NULL)
|
||||
|
||||
MCFG_SOUND_ADD("ym2413", YM2413, XTAL_53_693175MHz/15)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
|
||||
MACHINE_CONFIG_END
|
||||
@ -765,12 +783,6 @@ static MACHINE_CONFIG_DERIVED( sg1000m3, sms_fm )
|
||||
MCFG_CPU_MODIFY("maincpu")
|
||||
MCFG_CPU_IO_MAP(sg1000m3_io)
|
||||
|
||||
// Mark III does not have TH input
|
||||
MCFG_SMS_CONTROL_PORT_MODIFY(CONTROL1_TAG)
|
||||
MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(NULL)
|
||||
MCFG_SMS_CONTROL_PORT_MODIFY(CONTROL2_TAG)
|
||||
MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(NULL)
|
||||
|
||||
MCFG_DEVICE_REMOVE("slot")
|
||||
MCFG_SG1000MK3_CARTRIDGE_ADD("slot", sg1000mk3_cart, NULL)
|
||||
MACHINE_CONFIG_END
|
||||
|
@ -86,7 +86,8 @@ void sms_state::sms_get_inputs( address_space &space )
|
||||
m_port_dd_reg &= ~0x08 | (data2 >> 4); // TR (Button 2)
|
||||
|
||||
// Sega Mark III does not have TH line connected.
|
||||
if (!m_is_mark_iii)
|
||||
// Also, the japanese Master System does not set port $dd with TH input.
|
||||
if (!m_is_region_japan)
|
||||
{
|
||||
m_port_dd_reg &= ~0x40 | data1; // TH ctrl1
|
||||
m_port_dd_reg &= ~0x80 | (data2 << 1); // TH ctrl2
|
||||
@ -268,12 +269,6 @@ READ8_MEMBER(sms_state::sms_input_port_dd_r)
|
||||
|
||||
sms_get_inputs(space);
|
||||
|
||||
// Reset Button
|
||||
if ( m_port_reset )
|
||||
{
|
||||
m_port_dd_reg &= ~0x10 | (m_port_reset->read() & 0x01) << 4;
|
||||
}
|
||||
|
||||
// Check if TR of controller port 2 is set to output (0)
|
||||
if (!(m_io_ctrl_reg & 0x04))
|
||||
{
|
||||
@ -281,6 +276,24 @@ READ8_MEMBER(sms_state::sms_input_port_dd_r)
|
||||
m_port_dd_reg &= ~0x08 | ((m_io_ctrl_reg & 0x40) >> 3);
|
||||
}
|
||||
|
||||
if (m_is_region_japan)
|
||||
{
|
||||
// For japanese Master System, set upper 4 bits with TH/TR
|
||||
// direction bits of IO control register, according to Enri's
|
||||
// docs (http://www43.tok2.com/home/cmpslv/Sms/EnrSms.htm).
|
||||
m_port_dd_reg &= ~0x10 | ((m_io_ctrl_reg & 0x01) << 4);
|
||||
m_port_dd_reg &= ~0x20 | ((m_io_ctrl_reg & 0x04) << 3);
|
||||
m_port_dd_reg &= ~0x40 | ((m_io_ctrl_reg & 0x02) << 5);
|
||||
m_port_dd_reg &= ~0x80 | ((m_io_ctrl_reg & 0x08) << 4);
|
||||
return m_port_dd_reg;
|
||||
}
|
||||
|
||||
// Reset Button
|
||||
if ( m_port_reset )
|
||||
{
|
||||
m_port_dd_reg &= ~0x10 | (m_port_reset->read() & 0x01) << 4;
|
||||
}
|
||||
|
||||
// Check if TH of controller port 1 is set to output (0)
|
||||
if (!(m_io_ctrl_reg & 0x02))
|
||||
{
|
||||
@ -334,8 +347,8 @@ WRITE8_MEMBER(sms_state::sms_ym2413_data_port_w)
|
||||
|
||||
READ8_MEMBER(sms_state::gg_input_port_2_r)
|
||||
{
|
||||
//logerror("joy 2 read, val: %02x, pc: %04x\n", ((m_is_region_japan ? 0x00 : 0x40) | (m_port_start->read() & 0x80)), activecpu_get_pc());
|
||||
return ((m_is_region_japan ? 0x00 : 0x40) | (m_port_start->read() & 0x80));
|
||||
//logerror("joy 2 read, val: %02x, pc: %04x\n", (m_is_region_japan ? 0x00 : 0x40) | (m_port_start->read() & 0x80), activecpu_get_pc());
|
||||
return (m_is_region_japan ? 0x00 : 0x40) | (m_port_start->read() & 0x80);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user