summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/nes
diff options
context:
space:
mode:
author 0kmg <9137159+0kmg@users.noreply.github.com>2022-04-09 16:51:16 -0800
committer GitHub <noreply@github.com>2022-04-09 20:51:16 -0400
commit0270ca721b9b28dfcb597a52ca6f34c813f719de (patch)
tree9ef3a49a6caea75d60199991c17ea47111cf4d94 /src/devices/bus/nes
parent07b5dc9d4754a10edea50cc3b376eb89c4cbdc0d (diff)
bus/nes: Added support for Sachen's Zhōngguó Dàhēng cartridge. (#9540)
Diffstat (limited to 'src/devices/bus/nes')
-rw-r--r--src/devices/bus/nes/mmc3_clones.cpp75
-rw-r--r--src/devices/bus/nes/mmc3_clones.h25
-rw-r--r--src/devices/bus/nes/nes_carts.cpp3
-rw-r--r--src/devices/bus/nes/nes_ines.hxx2
-rw-r--r--src/devices/bus/nes/nes_pcb.hxx3
-rw-r--r--src/devices/bus/nes/nes_slot.h2
6 files changed, 106 insertions, 4 deletions
diff --git a/src/devices/bus/nes/mmc3_clones.cpp b/src/devices/bus/nes/mmc3_clones.cpp
index d38bb934354..23e2969b149 100644
--- a/src/devices/bus/nes/mmc3_clones.cpp
+++ b/src/devices/bus/nes/mmc3_clones.cpp
@@ -52,6 +52,7 @@ DEFINE_DEVICE_TYPE(NES_COCOMA, nes_cocoma_device, "nes_cocoma",
DEFINE_DEVICE_TYPE(NES_GOUDER, nes_gouder_device, "nes_gouder", "NES Cart Gouder PCB")
DEFINE_DEVICE_TYPE(NES_SA9602B, nes_sa9602b_device, "nes_sa9602b", "NES Cart SA-9602B PCB")
DEFINE_DEVICE_TYPE(NES_SACHEN_SHERO, nes_sachen_shero_device, "nes_shero", "NES Cart Street Hero PCB")
+DEFINE_DEVICE_TYPE(NES_SACHEN_ZGDH, nes_sachen_zgdh_device, "nes_zgdh", "NES Cart Zhongguo Daheng PCB")
DEFINE_DEVICE_TYPE(NES_A9746, nes_a9746_device, "nes_bmc_a9746", "NES Cart A-9746 PCB")
DEFINE_DEVICE_TYPE(NES_A88S1, nes_a88s1_device, "nes_a88s1", "NES Cart BMC A88S-1 PCB")
@@ -294,6 +295,11 @@ nes_sachen_shero_device::nes_sachen_shero_device(const machine_config &mconfig,
{
}
+nes_sachen_zgdh_device::nes_sachen_zgdh_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : nes_txrom_device(mconfig, NES_SACHEN_ZGDH, tag, owner, clock), m_reg(0)
+{
+}
+
nes_a9746_device::nes_a9746_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: nes_txrom_device(mconfig, NES_A9746, tag, owner, clock)
{
@@ -689,6 +695,20 @@ void nes_sachen_shero_device::pcb_reset()
mmc3_common_initialize(0xff, 0xff, 0);
}
+void nes_sachen_zgdh_device::device_start()
+{
+ mmc3_start();
+ save_item(NAME(m_reg));
+}
+
+void nes_sachen_zgdh_device::pcb_reset()
+{
+ assert(m_vram.size() >= 0x2000);
+
+ m_reg = 0;
+ mmc3_common_initialize(0x1f, 0x7f, 0);
+}
+
void nes_a9746_device::device_start()
{
mmc3_start();
@@ -2118,6 +2138,61 @@ u8 nes_sachen_shero_device::read_l(offs_t offset)
/*-------------------------------------------------
+ SACHEN-ZGDH
+
+ Sachen board used for Zhongguo Daheng
+
+ NES 2.0: mapper 512
+
+ In MAME: Supported.
+
+ -------------------------------------------------*/
+
+u8 nes_sachen_zgdh_device::nt_r(offs_t offset)
+{
+ if (m_reg == 1)
+ return m_vram[0x1000 + (offset & 0x0fff)];
+ else
+ return device_nes_cart_interface::nt_r(offset);
+}
+
+void nes_sachen_zgdh_device::nt_w(offs_t offset, u8 data)
+{
+ if (m_reg == 1)
+ m_vram[0x1000 + (offset & 0x0fff)] = data;
+ else
+ device_nes_cart_interface::nt_w(offset, data);
+}
+
+void nes_sachen_zgdh_device::set_chr(u8 chr, int chr_base, int chr_mask)
+{
+ if (m_reg <= 1)
+ {
+ chr = CHRROM;
+ m_chr_mask = 0x7f;
+ }
+ else
+ {
+ chr = CHRRAM;
+ m_chr_mask = 0x03;
+ }
+ nes_txrom_device::set_chr(chr, chr_base, m_chr_mask);
+}
+
+void nes_sachen_zgdh_device::write_l(offs_t offset, u8 data)
+{
+ LOG_MMC(("zgdh write_l, offset: %04x, data: %02x\n", offset, data));
+
+ offset += 0x100;
+ if ((offset & 0x1100) == 0x0100)
+ {
+ m_reg = data & 0x03;
+ set_chr(m_chr_source, m_chr_base, m_chr_mask);
+ }
+}
+
+/*-------------------------------------------------
+
UNL-A9746
Games: Toy Story, Super 1997 4 in 1 (NT-8029)
diff --git a/src/devices/bus/nes/mmc3_clones.h b/src/devices/bus/nes/mmc3_clones.h
index d6da92864d6..c9cd8b0e57a 100644
--- a/src/devices/bus/nes/mmc3_clones.h
+++ b/src/devices/bus/nes/mmc3_clones.h
@@ -476,6 +476,30 @@ private:
u8 m_reg;
};
+// ======================> nes_sachen_zgdh_device
+
+class nes_sachen_zgdh_device : public nes_txrom_device
+{
+public:
+ // construction/destruction
+ nes_sachen_zgdh_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+
+ virtual void write_l(offs_t offset, u8 data) override;
+ virtual u8 nt_r(offs_t offset) override;
+ virtual void nt_w(offs_t offset, u8 data) override;
+
+ virtual void pcb_reset() override;
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+
+ virtual void set_chr(u8 chr, int chr_base, int chr_mask) override;
+
+private:
+ u8 m_reg;
+};
+
// ======================> nes_a9746_device
class nes_a9746_device : public nes_txrom_device
@@ -1229,6 +1253,7 @@ DECLARE_DEVICE_TYPE(NES_COCOMA, nes_cocoma_device)
DECLARE_DEVICE_TYPE(NES_GOUDER, nes_gouder_device)
DECLARE_DEVICE_TYPE(NES_SA9602B, nes_sa9602b_device)
DECLARE_DEVICE_TYPE(NES_SACHEN_SHERO, nes_sachen_shero_device)
+DECLARE_DEVICE_TYPE(NES_SACHEN_ZGDH, nes_sachen_zgdh_device)
DECLARE_DEVICE_TYPE(NES_A9746, nes_a9746_device)
DECLARE_DEVICE_TYPE(NES_A88S1, nes_a88s1_device)
diff --git a/src/devices/bus/nes/nes_carts.cpp b/src/devices/bus/nes/nes_carts.cpp
index 93cca5a75f6..33178c9fd3c 100644
--- a/src/devices/bus/nes/nes_carts.cpp
+++ b/src/devices/bus/nes/nes_carts.cpp
@@ -364,7 +364,8 @@ void nes_cart(device_slot_interface &device)
device.option_add_internal("sfight3", NES_SF3);
device.option_add_internal("gouder", NES_GOUDER);
device.option_add_internal("sa9602b", NES_SA9602B);
- device.option_add_internal("unl_shero", NES_SACHEN_SHERO);
+ device.option_add_internal("sachen_shero", NES_SACHEN_SHERO);
+ device.option_add_internal("sachen_zgdh", NES_SACHEN_ZGDH);
device.option_add_internal("a9746", NES_A9746); // mapper 219
// misc multigame cart boards
device.option_add_internal("benshieng", NES_BENSHIENG);
diff --git a/src/devices/bus/nes/nes_ines.hxx b/src/devices/bus/nes/nes_ines.hxx
index b7cdca3fa35..21a5388deea 100644
--- a/src/devices/bus/nes/nes_ines.hxx
+++ b/src/devices/bus/nes/nes_ines.hxx
@@ -490,7 +490,7 @@ static const nes_mmc mmc_list[] =
{ 452, BMC_DS927 },
// 453 Realtec 8042
// 454...511 Unused
- // 512 probably the correct MMC3 clone for chuugokt in nes.xml
+ { 512, SACHEN_ZGDH },
{ 513, SACHEN_SA9602B },
// 514 seems to be for skaraok, currently set to UNKNOWN in nes.xml
// 515 Korean Family Noraebang karaoke cart with expansion cart, mic, and YM2413!
diff --git a/src/devices/bus/nes/nes_pcb.hxx b/src/devices/bus/nes/nes_pcb.hxx
index d409d81969c..a41bb0f5629 100644
--- a/src/devices/bus/nes/nes_pcb.hxx
+++ b/src/devices/bus/nes/nes_pcb.hxx
@@ -369,7 +369,8 @@ static const nes_pcb pcb_list[] =
{ "jyc_c", JYCOMPANY_C },
{ "tek90", JYCOMPANY_A },
{ "sa9602b", SACHEN_SA9602B },
- { "unl_shero", SACHEN_SHERO },
+ { "sachen_shero", SACHEN_SHERO },
+ { "sachen_zgdh", SACHEN_ZGDH },
{ "a9746", UNL_A9746 },
{ "mmalee2", UNL_MMALEE },
{ "unl_2708", UNL_2708 },
diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h
index 95ae301ce1f..5ff2747254f 100644
--- a/src/devices/bus/nes/nes_slot.h
+++ b/src/devices/bus/nes/nes_slot.h
@@ -72,7 +72,7 @@ enum
SACHEN_SA009, SACHEN_SA0036, SACHEN_SA0037,
SACHEN_SA72007, SACHEN_SA72008, SACHEN_SA9602B,
SACHEN_TCA01, SACHEN_TCU01, SACHEN_TCU02, SACHEN_3013, SACHEN_3014,
- SACHEN_74LS374, SACHEN_74LS374_ALT, SACHEN_SHERO,
+ SACHEN_74LS374, SACHEN_74LS374_ALT, SACHEN_SHERO, SACHEN_ZGDH,
// Sunsoft
SUNSOFT_1, SUNSOFT_2, SUNSOFT_3, SUNSOFT_4,
SUNSOFT_DCS, SUNSOFT_5, SUNSOFT_FME7,