From 9f95c4fb8f4dc1a236961592e97a6daba2cff72d Mon Sep 17 00:00:00 2001 From: etabeta78 Date: Fri, 26 Dec 2014 08:00:33 +0100 Subject: (MESS) gamegear: fixed detection of SMS games (via adapter) and added support for connecting a SMS pad to the unit (via Gear2Gear port + adapter) to play 2players games. [Enik Land] out of whatsnew: needless to say, we are not yet in the position to use the Gear2Gear port to link two gamegear units, so don't ask ;-) --- src/emu/bus/bus.mak | 11 ++++++++ src/emu/bus/sms_ctrl/multitap.c | 2 +- src/emu/bus/sms_ctrl/sportsjp.c | 4 +-- src/emu/bus/sms_ctrl/sportsjp.h | 4 +-- src/mess/drivers/sms.c | 45 ++++++++++++++++++++++++------ src/mess/includes/sms.h | 7 ++++- src/mess/machine/sms.c | 61 +++++++++++++++++++++++++++++++---------- src/mess/mess.mak | 1 + 8 files changed, 105 insertions(+), 30 deletions(-) diff --git a/src/emu/bus/bus.mak b/src/emu/bus/bus.mak index 8f1e0e7798a..dceb9529df7 100644 --- a/src/emu/bus/bus.mak +++ b/src/emu/bus/bus.mak @@ -1252,6 +1252,17 @@ BUSOBJS += $(BUSOBJ)/gameboy/rom.o BUSOBJS += $(BUSOBJ)/gameboy/mbc.o endif +#------------------------------------------------- +# +#@src/emu/bus/gamegear/gear2gear.h,BUSES += GAMEGEAR +#------------------------------------------------- + +ifneq ($(filter GAMEGEAR,$(BUSES)),) +OBJDIRS += $(BUSOBJ)/gamegear +BUSOBJS += $(BUSOBJ)/gamegear/gear2gear.o +BUSOBJS += $(BUSOBJ)/gamegear/smsctrladp.o +endif + #------------------------------------------------- # #@src/emu/bus/gba/gba_slot.h,BUSES += GBA diff --git a/src/emu/bus/sms_ctrl/multitap.c b/src/emu/bus/sms_ctrl/multitap.c index 481a331e1dc..6f27588889c 100644 --- a/src/emu/bus/sms_ctrl/multitap.c +++ b/src/emu/bus/sms_ctrl/multitap.c @@ -29,7 +29,7 @@ const device_type SMS_MULTITAP = &device_creator; //------------------------------------------------- sms_multitap_device::sms_multitap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, SMS_MULTITAP, "Furrtek's Multitap", tag, owner, clock, "sms_multitap", __FILE__), + device_t(mconfig, SMS_MULTITAP, "Multitap", tag, owner, clock, "sms_multitap", __FILE__), device_sms_control_port_interface(mconfig, *this), m_subctrl1_port(*this, "ctrl1"), m_subctrl2_port(*this, "ctrl2"), diff --git a/src/emu/bus/sms_ctrl/sportsjp.c b/src/emu/bus/sms_ctrl/sportsjp.c index 9e692e32abf..4fc166ccd3d 100644 --- a/src/emu/bus/sms_ctrl/sportsjp.c +++ b/src/emu/bus/sms_ctrl/sportsjp.c @@ -1,13 +1,13 @@ /********************************************************************** - Sega Master System "Sports Pad" (japanese model) emulation + Sega Master System "Sports Pad" (Japanese model) emulation Copyright MESS Team. Visit http://mamedev.org for licensing and usage restrictions. **********************************************************************/ -// The japanese Sports Pad controller is only required to play the cartridge +// The Japanese Sports Pad controller is only required to play the cartridge // Sports Pad Soccer, released in Japan. It uses a different mode than the // used by the US model, due to missing output lines on Sega Mark III // controller ports. diff --git a/src/emu/bus/sms_ctrl/sportsjp.h b/src/emu/bus/sms_ctrl/sportsjp.h index 065f8293a97..b8b643519fd 100644 --- a/src/emu/bus/sms_ctrl/sportsjp.h +++ b/src/emu/bus/sms_ctrl/sportsjp.h @@ -1,13 +1,13 @@ /********************************************************************** - Sega Master System "Sports Pad" (japanese model) emulation + Sega Master System "Sports Pad" (Japanese model) emulation Copyright MESS Team. Visit http://mamedev.org for licensing and usage restrictions. **********************************************************************/ -// The japanese Sports Pad controller is only required to play the cartridge +// The Japanese Sports Pad controller is only required to play the cartridge // Sports Pad Soccer, released in Japan. It uses a different mode than the // used by the US model, due to missing output lines on Sega Mark III // controller ports. diff --git a/src/mess/drivers/sms.c b/src/mess/drivers/sms.c index d47c95f0cab..7d91e446f95 100644 --- a/src/mess/drivers/sms.c +++ b/src/mess/drivers/sms.c @@ -13,7 +13,6 @@ To do: - SIO interface for Game Gear (needs netplay, I guess) - - Gear to Gear Port SMS Controller Adaptor - Sega Demo Unit II (kiosk expansion device) - SMS Disk System (floppy disk drive expansion device) - unreleased - Rapid button of Japanese Master System @@ -24,7 +23,7 @@ - Software compatibility flags, by region and/or BIOS - 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) + that has homebrew software support The Game Gear SIO hardware is not emulated but has some placeholders in 'machine/sms.c' @@ -47,6 +46,29 @@ -------------------------------------------------------------------------------- +General compatibility issues on real hardware (not emulation bugs): + +- Some ROMs have issues or don't work when running on a console of different + region; +- Many Japanese/Korean or homebrew ROMs don't have the signature required by + BIOSes of consoles sold overseas; +- Paddle games need to detect the system region as Japanese to work with the + Paddle controller; +- Few games of the ones with FM support need to detect the system region as + Japanese to play FM sound; +- The Light Phaser gun doesn't work with the Japanese SMS; +- There are reports about Light Phaser working on the second Korean console + version, and a Korean advert shows support on the first version (Gam*Boy I, + although based on Japanese SMS); +- The Korean SMS versions have Japanese-format cartridge slot, but only on the + first (Gam*Boy I) the region is detected as Japanese; +- Some SMS ROMs don't run when are plugged-in to SMS expansion slot, through + the gender adapter; +- Some SMS ROMs don't run when are plugged-in to a Game Gear, through the + Master Gear adapter; + +-------------------------------------------------------------------------------- + Sega Master System II Sega 1990 @@ -338,10 +360,10 @@ static ADDRESS_MAP_START( gg_io, AS_IO, 8, sms_state ) AM_RANGE(0x40, 0x7f) AM_DEVWRITE("gamegear", gamegear_device, write) AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sega315_5124_device, vram_read, vram_write) AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sega315_5124_device, register_read, register_write) - AM_RANGE(0xc0, 0xc0) AM_READ_PORT("GG_PORT_DC") - AM_RANGE(0xc1, 0xc1) AM_READ_PORT("GG_PORT_DD") - AM_RANGE(0xdc, 0xdc) AM_READ_PORT("GG_PORT_DC") - AM_RANGE(0xdd, 0xdd) AM_READ_PORT("GG_PORT_DD") + AM_RANGE(0xc0, 0xc0) AM_READ(sms_input_port_dc_r) + AM_RANGE(0xc1, 0xc1) AM_READ(sms_input_port_dd_r) + AM_RANGE(0xdc, 0xdc) AM_READ(sms_input_port_dc_r) + AM_RANGE(0xdd, 0xdd) AM_READ(sms_input_port_dd_r) ADDRESS_MAP_END @@ -439,9 +461,6 @@ static INPUT_PORTS_START( gg ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("GG_PORT_DD") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("START") PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("Start") /* Game Gear START */ @@ -785,6 +804,10 @@ static MACHINE_CONFIG_START( gamegear, sms_state ) MCFG_GG_CARTRIDGE_ADD("slot", gg_cart, NULL) MCFG_SOFTWARE_LIST_ADD("cart_list", "gamegear") + + MCFG_GG_GEAR2GEAR_PORT_ADD("gear2gear", gg_gear2gear_port_devices, NULL) + MCFG_GG_GEAR2GEAR_PORT_TH_INPUT_HANDLER(WRITELINE(sms_state, sms_ctrl2_th_input)) // not verified + //MCFG_GG_GEAR2GEAR_PORT_PIXEL_HANDLER(READ32(sms_state, sms_pixel_color)) // only for GG-TV mod MACHINE_CONFIG_END @@ -963,6 +986,10 @@ ROM_END - Sega Mark III Soft Desk 10 - Sega Shooting Zone + The SMS Store Display Unit is labeled PD-W UNIT. Pictures found on Internet + show cartridges with a label where a not-for-sale message is written along + the information that it is for use on the Product Display-Working Unit. + ***************************************************************************/ /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ diff --git a/src/mess/includes/sms.h b/src/mess/includes/sms.h index 3c694451363..7d159a96824 100644 --- a/src/mess/includes/sms.h +++ b/src/mess/includes/sms.h @@ -19,6 +19,7 @@ #define CONTROL1_TAG "ctrl1" #define CONTROL2_TAG "ctrl2" +#include "bus/gamegear/gear2gear.h" #include "bus/sms_ctrl/smsctrl.h" #include "bus/sms_exp/smsexp.h" #include "bus/sega8/sega8_slot.h" @@ -36,6 +37,8 @@ public: m_region_maincpu(*this, "maincpu"), m_port_ctrl1(*this, CONTROL1_TAG), m_port_ctrl2(*this, CONTROL2_TAG), + m_port_gear2gear(*this, "gear2gear"), + m_port_gg_dc(*this, "GG_PORT_DC"), m_port_pause(*this, "PAUSE"), m_port_reset(*this, "RESET"), m_port_start(*this, "START"), @@ -63,6 +66,8 @@ public: required_memory_region m_region_maincpu; optional_device m_port_ctrl1; optional_device m_port_ctrl2; + optional_device m_port_gear2gear; + optional_ioport m_port_gg_dc; optional_ioport m_port_pause; optional_ioport m_port_reset; optional_ioport m_port_start; @@ -195,7 +200,7 @@ protected: void setup_media_slots(); void setup_enabled_slots(); void lphaser_hcount_latch(); - void sms_get_inputs(address_space &space); + void sms_get_inputs(); }; class smssdisp_state : public sms_state diff --git a/src/mess/machine/sms.c b/src/mess/machine/sms.c index b4bdb25e3d0..76c2bf0e527 100644 --- a/src/mess/machine/sms.c +++ b/src/mess/machine/sms.c @@ -45,6 +45,9 @@ WRITE_LINE_MEMBER(sms_state::sms_ctrl1_th_input) WRITE_LINE_MEMBER(sms_state::sms_ctrl2_th_input) { + if (m_is_gamegear && (!m_cartslot->exists() || !m_cartslot->m_cart->get_sms_mode())) + return; + // Check if TH of controller port 2 is set to input (1) if (m_io_ctrl_reg & 0x08) { @@ -63,9 +66,10 @@ WRITE_LINE_MEMBER(sms_state::sms_ctrl2_th_input) } -void sms_state::sms_get_inputs( address_space &space ) +void sms_state::sms_get_inputs() { - UINT8 data1, data2; + UINT8 data1 = 0xff; + UINT8 data2 = 0xff; m_port_dc_reg = 0xff; m_port_dd_reg = 0xff; @@ -74,12 +78,28 @@ void sms_state::sms_get_inputs( address_space &space ) // physical pins numbering. For register bits whose order differs, // it's necessary move the equivalent controller bits to match. - data1 = m_port_ctrl1->port_r(); - m_port_dc_reg &= ~0x0f | data1; // Up, Down, Left, Right - m_port_dc_reg &= ~0x10 | (data1 >> 1); // TL (Button 1) - m_port_dc_reg &= ~0x20 | (data1 >> 2); // TR (Button 2) + if (m_is_gamegear) + { + data1 = m_port_gg_dc->read(); + m_port_dc_reg &= ~0x03f | data1; + } + else + { + data1 = m_port_ctrl1->port_r(); + m_port_dc_reg &= ~0x0f | data1; // Up, Down, Left, Right + m_port_dc_reg &= ~0x10 | (data1 >> 1); // TL (Button 1) + m_port_dc_reg &= ~0x20 | (data1 >> 2); // TR (Button 2) + } - data2 = m_port_ctrl2->port_r(); + if (m_is_gamegear) + { + if (m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode()) + data2 = m_port_gear2gear->port_r(); + } + else + { + data2 = m_port_ctrl2->port_r(); + } m_port_dc_reg &= ~0xc0 | (data2 << 6); // Up, Down m_port_dd_reg &= ~0x03 | (data2 >> 2); // Left, Right m_port_dd_reg &= ~0x04 | (data2 >> 3); // TL (Button 1) @@ -116,7 +136,7 @@ READ8_MEMBER(sms_state::sms_fm_detect_r) } else { - sms_get_inputs(space); + sms_get_inputs(); return m_port_dc_reg; } } @@ -129,6 +149,12 @@ WRITE8_MEMBER(sms_state::sms_io_control_w) UINT8 ctrl1_port_data = 0xff; UINT8 ctrl2_port_data = 0xff; + if (m_is_gamegear && (!m_cartslot->exists() || !m_cartslot->m_cart->get_sms_mode())) + { + m_io_ctrl_reg = data; + return; + } + // Controller Port 1: // check if TR or TH are set to output (0). @@ -171,12 +197,16 @@ WRITE8_MEMBER(sms_state::sms_io_control_w) } if (!m_is_gamegear) m_port_ctrl2->port_w(ctrl2_port_data); + else + m_port_gear2gear->port_w(ctrl2_port_data); // not verified } // check if TH is set to input (1). if (data & 0x08) { if (!m_is_gamegear) ctrl2_port_data &= ~0x40 | m_port_ctrl2->port_r(); + else + ctrl2_port_data &= ~0x40 | m_port_gear2gear->port_r(); // not verified // check if TH input level is high (1) and was output/low (0) if ((ctrl2_port_data & 0x40) && !(m_io_ctrl_reg & 0x88)) @@ -232,17 +262,17 @@ READ8_MEMBER(sms_state::sms_input_port_dc_r) { if (m_is_mark_iii) { - sms_get_inputs(space); + sms_get_inputs(); return m_port_dc_reg; } - if (m_mem_ctrl_reg & IO_CHIP) + if (!m_is_gamegear && (m_mem_ctrl_reg & IO_CHIP)) { return 0xff; } else { - sms_get_inputs(space); + sms_get_inputs(); // Check if TR of controller port 1 is set to output (0) if (!(m_io_ctrl_reg & 0x01)) @@ -260,14 +290,14 @@ READ8_MEMBER(sms_state::sms_input_port_dd_r) { if (m_is_mark_iii) { - sms_get_inputs(space); + sms_get_inputs(); return m_port_dd_reg; } - if (m_mem_ctrl_reg & IO_CHIP) + if (!m_is_gamegear && (m_mem_ctrl_reg & IO_CHIP)) return 0xff; - sms_get_inputs(space); + sms_get_inputs(); // Check if TR of controller port 2 is set to output (0) if (!(m_io_ctrl_reg & 0x04)) @@ -276,12 +306,13 @@ READ8_MEMBER(sms_state::sms_input_port_dd_r) m_port_dd_reg &= ~0x08 | ((m_io_ctrl_reg & 0x40) >> 3); } - if (m_is_smsj) + if (m_is_smsj || (m_is_gamegear && m_is_gg_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). // This makes the console incapable of using the Light Phaser. + // Assume the same for a Japanese Game Gear. 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); diff --git a/src/mess/mess.mak b/src/mess/mess.mak index c48f3cc031f..9c283ba4bfe 100644 --- a/src/mess/mess.mak +++ b/src/mess/mess.mak @@ -595,6 +595,7 @@ BUSES += ECONET BUSES += EP64 BUSES += EPSON_SIO BUSES += GAMEBOY +BUSES += GAMEGEAR BUSES += GBA BUSES += GENERIC BUSES += IEEE488 -- cgit v1.2.3