From ab592dea638e66ce4b426fe70ad6342b68ba99e0 Mon Sep 17 00:00:00 2001 From: Fabio Priuli Date: Sun, 12 Oct 2014 11:30:13 +0000 Subject: [PATCH] (MESS) gamegear: added preliminary emulation of the Master Gear Adapter which allows to launch SMS games in the gamegear driver, with video chip in SMS mode. You can try this by launching mess.exe gamegear -cart mgear -cart2 your_sms_game (the -cart2 switch becomes available when you mount "mgear" in the main gamegear cart slot) [Fabio Priuli] out of the whatsnew: for the moment only fullpath loading is supported, and it is not ensured to work 100%. thanks to Enik Land for pointing me to the necessary info. --- .gitattributes | 4 +++ hash/gamegear.xml | 13 ++++++++ src/emu/bus/bus.mak | 2 ++ src/emu/bus/sega8/ccatch.c | 61 ++++++++++++++++++++++++++++++++++ src/emu/bus/sega8/ccatch.h | 33 ++++++++++++++++++ src/emu/bus/sega8/mgear.c | 44 ++++++++++++++++++++++++ src/emu/bus/sega8/mgear.h | 36 ++++++++++++++++++++ src/emu/bus/sega8/rom.c | 44 ------------------------ src/emu/bus/sega8/rom.h | 21 ------------ src/emu/bus/sega8/sega8_slot.c | 3 ++ src/mess/drivers/sg1000.c | 1 - src/mess/drivers/sms.c | 1 - 12 files changed, 196 insertions(+), 67 deletions(-) create mode 100644 src/emu/bus/sega8/ccatch.c create mode 100644 src/emu/bus/sega8/ccatch.h create mode 100644 src/emu/bus/sega8/mgear.c create mode 100644 src/emu/bus/sega8/mgear.h diff --git a/.gitattributes b/.gitattributes index c7d0fe450da..3e520f99c6e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1534,6 +1534,10 @@ src/emu/bus/scv/rom.c svneol=native#text/plain src/emu/bus/scv/rom.h svneol=native#text/plain src/emu/bus/scv/slot.c svneol=native#text/plain src/emu/bus/scv/slot.h svneol=native#text/plain +src/emu/bus/sega8/ccatch.c svneol=native#text/plain +src/emu/bus/sega8/ccatch.h svneol=native#text/plain +src/emu/bus/sega8/mgear.c svneol=native#text/plain +src/emu/bus/sega8/mgear.h svneol=native#text/plain src/emu/bus/sega8/rom.c svneol=native#text/plain src/emu/bus/sega8/rom.h svneol=native#text/plain src/emu/bus/sega8/sega8_slot.c svneol=native#text/plain diff --git a/hash/gamegear.xml b/hash/gamegear.xml index 233c052955f..b99fe8e7104 100644 --- a/hash/gamegear.xml +++ b/hash/gamegear.xml @@ -9960,4 +9960,17 @@ a certain item) --> + + Master Gear Adapter + 198? + <unknown> + + + + + + + + + diff --git a/src/emu/bus/bus.mak b/src/emu/bus/bus.mak index 986adb3a0b8..60765ec9059 100644 --- a/src/emu/bus/bus.mak +++ b/src/emu/bus/bus.mak @@ -1143,6 +1143,8 @@ ifneq ($(filter SEGA8,$(BUSES)),) OBJDIRS += $(BUSOBJ)/sega8 BUSOBJS += $(BUSOBJ)/sega8/sega8_slot.o BUSOBJS += $(BUSOBJ)/sega8/rom.o +BUSOBJS += $(BUSOBJ)/sega8/ccatch.o +BUSOBJS += $(BUSOBJ)/sega8/mgear.o endif #------------------------------------------------- diff --git a/src/emu/bus/sega8/ccatch.c b/src/emu/bus/sega8/ccatch.c new file mode 100644 index 00000000000..3e917fa8d09 --- /dev/null +++ b/src/emu/bus/sega8/ccatch.c @@ -0,0 +1,61 @@ +/*********************************************************************************************************** + + SG-1000 Card Catcher emulation + + Sega Card Catcher is a passthrough adapter for + SG-1000 to load games in MyCard format into the + main cartslot + + ***********************************************************************************************************/ + + +#include "emu.h" +#include "ccatch.h" + + +//------------------------------------------------- +// constructors +//------------------------------------------------- + +const device_type SEGA8_ROM_CARDCATCH = &device_creator; + + + +sega8_cardcatch_device::sega8_cardcatch_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : sega8_rom_device(mconfig, SEGA8_ROM_CARDCATCH, "SG-1000 Card Catcher Cart", tag, owner, clock, "sega8_ccatch", __FILE__), + m_card(*this, "cardslot") +{ +} + + +/*------------------------------------------------- + mapper specific handlers + -------------------------------------------------*/ + +READ8_MEMBER(sega8_cardcatch_device::read_cart) +{ + if (offset < 0x8000) + return m_card->read_cart(space, offset); + + return 0xff; +} + +WRITE8_MEMBER(sega8_cardcatch_device::write_cart) +{ + // this should never happen, because there is no RAM on cards + if (offset < 0x8000) + logerror("Attempt to write to MyCard\n"); +} + +static SLOT_INTERFACE_START(sg1000_card) + SLOT_INTERFACE_INTERNAL("rom", SEGA8_ROM_STD) +SLOT_INTERFACE_END + +static MACHINE_CONFIG_FRAGMENT( sub_slot ) + MCFG_SG1000_CARD_ADD("cardslot", sg1000_card, NULL) +MACHINE_CONFIG_END + +machine_config_constructor sega8_cardcatch_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( sub_slot ); +} diff --git a/src/emu/bus/sega8/ccatch.h b/src/emu/bus/sega8/ccatch.h new file mode 100644 index 00000000000..3a632e6f6ce --- /dev/null +++ b/src/emu/bus/sega8/ccatch.h @@ -0,0 +1,33 @@ +#ifndef __SEGA8_CCATCH_H +#define __SEGA8_CCATCH_H + +#include "sega8_slot.h" +#include "rom.h" + +// ======================> sega8_cardcatch_device + +class sega8_cardcatch_device : public sega8_rom_device +{ +public: + // construction/destruction + sega8_cardcatch_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_cart); + virtual DECLARE_WRITE8_MEMBER(write_cart); + virtual DECLARE_WRITE8_MEMBER(write_mapper) {} + + virtual machine_config_constructor device_mconfig_additions() const; + +protected: + required_device m_card; +}; + + + + + +// device type definition +extern const device_type SEGA8_ROM_CARDCATCH; + +#endif diff --git a/src/emu/bus/sega8/mgear.c b/src/emu/bus/sega8/mgear.c new file mode 100644 index 00000000000..601bef6b9ec --- /dev/null +++ b/src/emu/bus/sega8/mgear.c @@ -0,0 +1,44 @@ +/*********************************************************************************************************** + + Master Gear Adapter emulation + + ***********************************************************************************************************/ + + +#include "emu.h" +#include "mgear.h" + + +//------------------------------------------------- +// constructors +//------------------------------------------------- + +const device_type SEGA8_ROM_MGEAR = &device_creator; + +sega8_mgear_device::sega8_mgear_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : sega8_rom_device(mconfig, SEGA8_ROM_MGEAR, "Master Gear Adapter", tag, owner, clock, "sega8_mgear", __FILE__), + m_subslot(*this, "subslot") +{ +} + + +void sega8_mgear_device::device_start() +{ +} + +void sega8_mgear_device::device_reset() +{ +} + +/*------------------------------------------------- + mapper specific handlers + -------------------------------------------------*/ + +static MACHINE_CONFIG_FRAGMENT( sub_slot ) + MCFG_SMS_CARTRIDGE_ADD("subslot", sms_cart, NULL) +MACHINE_CONFIG_END + +machine_config_constructor sega8_mgear_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( sub_slot ); +} diff --git a/src/emu/bus/sega8/mgear.h b/src/emu/bus/sega8/mgear.h new file mode 100644 index 00000000000..27672464ced --- /dev/null +++ b/src/emu/bus/sega8/mgear.h @@ -0,0 +1,36 @@ +#ifndef __SEGA8_MGEAR_H +#define __SEGA8_MGEAR_H + +#include "sega8_slot.h" +#include "rom.h" + + +// ======================> sega8_mgear_device + +class sega8_mgear_device : public sega8_rom_device +{ +public: + // construction/destruction + sega8_mgear_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_cart) { return m_subslot->read_cart(space, offset); } + virtual DECLARE_WRITE8_MEMBER(write_cart) { m_subslot->write_cart(space, offset, data); } + virtual DECLARE_WRITE8_MEMBER(write_mapper) { m_subslot->write_mapper(space, offset, data); } + + virtual machine_config_constructor device_mconfig_additions() const; + +protected: + required_device m_subslot; +}; + + +// device type definition +extern const device_type SEGA8_ROM_MGEAR; + + +#endif diff --git a/src/emu/bus/sega8/rom.c b/src/emu/bus/sega8/rom.c index e2f89b3b3d2..9b222867ba3 100644 --- a/src/emu/bus/sega8/rom.c +++ b/src/emu/bus/sega8/rom.c @@ -20,7 +20,6 @@ const device_type SEGA8_ROM_STD = &device_creator; // Specific SG-1000 MkI - MkII cart types -const device_type SEGA8_ROM_CARDCATCH = &device_creator; const device_type SEGA8_ROM_OTHELLO = &device_creator; const device_type SEGA8_ROM_CASTLE = &device_creator; const device_type SEGA8_ROM_BASIC_L3 = &device_creator; @@ -56,13 +55,6 @@ sega8_rom_device::sega8_rom_device(const machine_config &mconfig, const char *ta -sega8_cardcatch_device::sega8_cardcatch_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : sega8_rom_device(mconfig, SEGA8_ROM_CARDCATCH, "SG-1000 Card Catcher Cart", tag, owner, clock, "sega8_ccatch", __FILE__), - m_card(*this, "cardslot") -{ -} - - sega8_othello_device::sega8_othello_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : sega8_rom_device(mconfig, SEGA8_ROM_OTHELLO, "SG-1000 Othello Cart", tag, owner, clock, "sega8_othello", __FILE__) { @@ -372,42 +364,6 @@ WRITE8_MEMBER(sega8_rom_device::write_mapper) } -/*------------------------------------------------- - - Sega Card Catcher is a passthrough adapter for - SG-1000 to load games in MyCard format into the - main cartslot - - -------------------------------------------------*/ - -READ8_MEMBER(sega8_cardcatch_device::read_cart) -{ - if (offset < 0x8000) - return m_card->read_cart(space, offset); - - return 0xff; -} - -WRITE8_MEMBER(sega8_cardcatch_device::write_cart) -{ - // this should never happen, because there is no RAM on cards - if (offset < 0x8000) - logerror("Attempt to write to MyCard\n"); -} - -static SLOT_INTERFACE_START(sg1000_card) - SLOT_INTERFACE_INTERNAL("rom", SEGA8_ROM_STD) -SLOT_INTERFACE_END - -static MACHINE_CONFIG_FRAGMENT( sub_slot ) - MCFG_SG1000_CARD_ADD("cardslot", sg1000_card, NULL) -MACHINE_CONFIG_END - -machine_config_constructor sega8_cardcatch_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( sub_slot ); -} - /*------------------------------------------------- Othello is a SG-1000 game featuring 2K of diff --git a/src/emu/bus/sega8/rom.h b/src/emu/bus/sega8/rom.h index 79759a7d9e7..7e96ef99974 100644 --- a/src/emu/bus/sega8/rom.h +++ b/src/emu/bus/sega8/rom.h @@ -34,26 +34,6 @@ protected: -// ======================> sega8_cardcatch_device - -class sega8_cardcatch_device : public sega8_rom_device -{ -public: - // construction/destruction - sega8_cardcatch_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // reading and writing - virtual DECLARE_READ8_MEMBER(read_cart); - virtual DECLARE_WRITE8_MEMBER(write_cart); - virtual DECLARE_WRITE8_MEMBER(write_mapper) {} - - virtual machine_config_constructor device_mconfig_additions() const; - -protected: - required_device m_card; -}; - - // ======================> sega8_othello_device class sega8_othello_device : public sega8_rom_device @@ -363,7 +343,6 @@ public: // device type definition extern const device_type SEGA8_ROM_STD; -extern const device_type SEGA8_ROM_CARDCATCH; extern const device_type SEGA8_ROM_OTHELLO; extern const device_type SEGA8_ROM_CASTLE; extern const device_type SEGA8_ROM_BASIC_L3; diff --git a/src/emu/bus/sega8/sega8_slot.c b/src/emu/bus/sega8/sega8_slot.c index 7401c40e2e3..2933929081c 100644 --- a/src/emu/bus/sega8/sega8_slot.c +++ b/src/emu/bus/sega8/sega8_slot.c @@ -822,6 +822,8 @@ void sega8_cart_slot_device::internal_header_logging(UINT8 *ROM, UINT32 len, UIN // slot interfaces #include "rom.h" +#include "ccatch.h" +#include "mgear.h" SLOT_INTERFACE_START(sg1000_cart) SLOT_INTERFACE_INTERNAL("rom", SEGA8_ROM_STD) @@ -869,5 +871,6 @@ SLOT_INTERFACE_START(gg_cart) SLOT_INTERFACE_INTERNAL("rom", SEGA8_ROM_STD) SLOT_INTERFACE_INTERNAL("eeprom", SEGA8_ROM_EEPROM) SLOT_INTERFACE_INTERNAL("codemasters", SEGA8_ROM_CODEMASTERS) + SLOT_INTERFACE_INTERNAL("mgear", SEGA8_ROM_MGEAR) SLOT_INTERFACE_END diff --git a/src/mess/drivers/sg1000.c b/src/mess/drivers/sg1000.c index 3d395f9d45b..48ec3a29026 100644 --- a/src/mess/drivers/sg1000.c +++ b/src/mess/drivers/sg1000.c @@ -67,7 +67,6 @@ Notes: #include "includes/sg1000.h" #include "bus/rs232/rs232.h" -#include "bus/sega8/rom.h" /*************************************************************************** diff --git a/src/mess/drivers/sms.c b/src/mess/drivers/sms.c index 44964322239..8408b66b16d 100644 --- a/src/mess/drivers/sms.c +++ b/src/mess/drivers/sms.c @@ -231,7 +231,6 @@ DC00 - Selection buttons #2, 9-16 (R) #include "sound/2413intf.h" #include "video/315_5124.h" #include "includes/sms.h" -#include "bus/sega8/rom.h" #include "sms1.lh"