From f0d98df48769ffaa92155137aa5733eeabe90f93 Mon Sep 17 00:00:00 2001 From: 0kmg <9137159+0kmg@users.noreply.github.com> Date: Fri, 19 Nov 2021 15:34:51 -0900 Subject: bus/nes: Added partial code for unlicensed game Dragon Fighter. (#8833) --- hash/nes.xml | 4 +-- src/devices/bus/nes/mmc3_clones.cpp | 59 +++++++++++++++++++++++++++++++++++++ src/devices/bus/nes/mmc3_clones.h | 25 ++++++++++++++++ src/devices/bus/nes/nes_carts.cpp | 1 + src/devices/bus/nes/nes_ines.hxx | 4 +-- src/devices/bus/nes/nes_pcb.hxx | 2 +- src/devices/bus/nes/nes_slot.h | 2 +- 7 files changed, 91 insertions(+), 6 deletions(-) diff --git a/hash/nes.xml b/hash/nes.xml index 35c0e8c32c8..9b0fe1ac0ff 100644 --- a/hash/nes.xml +++ b/hash/nes.xml @@ -63349,8 +63349,8 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx 19?? Flying Star - - + + diff --git a/src/devices/bus/nes/mmc3_clones.cpp b/src/devices/bus/nes/mmc3_clones.cpp index 5bf01d9f6a8..1f289cf3899 100644 --- a/src/devices/bus/nes/mmc3_clones.cpp +++ b/src/devices/bus/nes/mmc3_clones.cpp @@ -29,6 +29,7 @@ //------------------------------------------------- DEFINE_DEVICE_TYPE(NES_NITRA, nes_nitra_device, "nes_nitra", "NES Cart Nitra PCB") +DEFINE_DEVICE_TYPE(NES_BMW8544, nes_bmw8544_device, "nes_bmw8544", "NES Cart BMW8544 PCB") DEFINE_DEVICE_TYPE(NES_FS6, nes_fs6_device, "nes_fs6", "NES Cart Fight Street VI PCB") DEFINE_DEVICE_TYPE(NES_SBROS11, nes_sbros11_device, "nes_smb11", "NES Cart SMB 11 PCB") DEFINE_DEVICE_TYPE(NES_MALISB, nes_malisb_device, "nes_malisb", "NES Cart Mali Splash Bomb PCB") @@ -128,6 +129,11 @@ nes_nitra_device::nes_nitra_device(const machine_config &mconfig, const char *ta { } +nes_bmw8544_device::nes_bmw8544_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_txrom_device(mconfig, NES_BMW8544, tag, owner, clock), m_reg(0) +{ +} + nes_fs6_device::nes_fs6_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : nes_txrom_device(mconfig, NES_FS6, tag, owner, clock) { @@ -437,6 +443,23 @@ nes_coolboy_device::nes_coolboy_device(const machine_config &mconfig, const char { } + + + +void nes_bmw8544_device::device_start() +{ + mmc3_start(); + save_item(NAME(m_reg)); +} + +void nes_bmw8544_device::pcb_reset() +{ + m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; + + m_reg = 0; + mmc3_common_initialize(0x0f, 0xff, 0); +} + void nes_family4646_device::device_start() { mmc3_start(); @@ -1030,6 +1053,42 @@ void nes_nitra_device::write_h(offs_t offset, uint8_t data) txrom_write((offset & 0x6000) | ((offset & 0x400) >> 10), offset & 0xff); } +/*------------------------------------------------- + + Board BMW8544 + + Games: Dragon Fighter (Flying Star) + + MMC3 clone with poorly understood PRG/CHR banking. + + NES 2.0: mapper 292 + + In MAME: Not supported. + + -------------------------------------------------*/ + +void nes_bmw8544_device::set_prg(int prg_base, int prg_mask) +{ + nes_txrom_device::set_prg(prg_base, prg_mask); + prg8_89(m_reg); +} + +u8 nes_bmw8544_device::read_m(offs_t offset) +{ +// LOG_MMC(("bmw8544 read_m, offset: %04x\n", offset)); + + // CHR banking may be done by reads in this address range + + return nes_txrom_device::read_m(offset); +} + +void nes_bmw8544_device::write_m(offs_t offset, u8 data) +{ + LOG_MMC(("bmw8544 write_m, offset: %04x, data: %02x\n", offset, data)); + m_reg = data; + prg8_89(data); +} + /*------------------------------------------------- Board UNL-FS6 diff --git a/src/devices/bus/nes/mmc3_clones.h b/src/devices/bus/nes/mmc3_clones.h index 31b80c5cb18..faeacccb091 100644 --- a/src/devices/bus/nes/mmc3_clones.h +++ b/src/devices/bus/nes/mmc3_clones.h @@ -21,6 +21,30 @@ public: }; +// ======================> nes_bmw8544_device + +class nes_bmw8544_device : public nes_txrom_device +{ +public: + // construction/destruction + nes_bmw8544_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual u8 read_m(offs_t offset) override; + virtual void write_m(offs_t offset, u8 data) override; + + virtual void pcb_reset() override; + +protected: + // device-level overrides + virtual void device_start() override; + + virtual void set_prg(int prg_base, int prg_mask) override; + +private: + u8 m_reg; +}; + + // ======================> nes_fs6_device class nes_fs6_device : public nes_txrom_device @@ -1119,6 +1143,7 @@ private: // device type definition DECLARE_DEVICE_TYPE(NES_NITRA, nes_nitra_device) +DECLARE_DEVICE_TYPE(NES_BMW8544, nes_bmw8544_device) DECLARE_DEVICE_TYPE(NES_FS6, nes_fs6_device) DECLARE_DEVICE_TYPE(NES_SBROS11, nes_sbros11_device) DECLARE_DEVICE_TYPE(NES_MALISB, nes_malisb_device) diff --git a/src/devices/bus/nes/nes_carts.cpp b/src/devices/bus/nes/nes_carts.cpp index b5da813c390..c7911546d70 100644 --- a/src/devices/bus/nes/nes_carts.cpp +++ b/src/devices/bus/nes/nes_carts.cpp @@ -343,6 +343,7 @@ void nes_cart(device_slot_interface &device) device.option_add_internal("somari", NES_SOMARI); // mapper 116 device.option_add_internal("huang2", NES_HUANG2); // mapper 116 also device.option_add_internal("nitra", NES_NITRA); + device.option_add_internal("bmw8544", NES_BMW8544); device.option_add_internal("fs6", NES_FS6); // mapper 196 alt? (for Street Fighter VI / Fight Street VI); device.option_add_internal("sbros11", NES_SBROS11); device.option_add_internal("unl_malisb", NES_MALISB); // used by Super Mali Splash Bomb diff --git a/src/devices/bus/nes/nes_ines.hxx b/src/devices/bus/nes/nes_ines.hxx index 61cb9fc1fb2..7ebaf16f0c9 100644 --- a/src/devices/bus/nes/nes_ines.hxx +++ b/src/devices/bus/nes/nes_ines.hxx @@ -327,9 +327,9 @@ static const nes_mmc mmc_list[] = { 289, BMC_60311C }, { 290, BMC_NTD_03 }, { 291, BMC_NT639 }, - // { 292, UNL_DRAGONFIGHTER }, in nes.xml, not emulated yet + { 292, UNL_BMW8544 }, // Dragon Fighter by Flying Star // 293 NewStar multicarts, do we have these in nes.xml? - { 294, BMC_FAMILY_4646 }, // FIXME: is this really exactly the same as mapper 134? + { 294, BMC_FAMILY_4646 }, // FIXME: is this really exactly the same as mapper 134? // 295 JY multicarts not yet in nes.xml // 296 VT3x handhelds { 297, TXC_22110 }, // 2-in-1 Uzi Lightgun diff --git a/src/devices/bus/nes/nes_pcb.hxx b/src/devices/bus/nes/nes_pcb.hxx index 4d05211c4d2..2d1c0214955 100644 --- a/src/devices/bus/nes/nes_pcb.hxx +++ b/src/devices/bus/nes/nes_pcb.hxx @@ -229,6 +229,7 @@ static const nes_pcb pcb_list[] = { "somari", SOMARI_SL12 }, // mapper 116 { "huang2", SOMARI_HUANG2 }, // mapper 116 also { "nitra", NITRA_TDA }, + { "bmw8544", UNL_BMW8544 }, { "fs6", UNL_FS6 }, // mapper 196 alt? (for Street Fighter VI / Fight Street VI }, { "sbros11", BTL_SBROS11 }, { "family4646", BMC_FAMILY_4646 }, @@ -396,7 +397,6 @@ static const nes_pcb pcb_list[] = { "onebus", UNSUPPORTED_BOARD }, { "coolboy", UNSUPPORTED_BOARD }, { "pec586", UNSUPPORTED_BOARD }, - { "unl_drgnfgt", UNSUPPORTED_BOARD }, // Dragon Fighter by Flying Star { "test", TEST_BOARD }, { "unknown", UNKNOWN_BOARD } // a few pirate dumps uses the wrong mapper... }; diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h index 9c01f4f126b..8509e2a74c2 100644 --- a/src/devices/bus/nes/nes_slot.h +++ b/src/devices/bus/nes/nes_slot.h @@ -116,7 +116,7 @@ enum UNL_SF3, UNL_RACERMATE, UNL_EDU2K, UNL_STUDYNGAME, UNL_603_5052, UNL_H2288, UNL_158B, UNL_2708, UNL_MALISB, UNL_AC08, UNL_A9746, UNL_43272, UNL_TF1201, UNL_TH21311, - UNL_CITYFIGHT, UNL_NINJARYU, UNL_EH8813A, UNL_RT01, + UNL_BMW8544, UNL_CITYFIGHT, UNL_NINJARYU, UNL_EH8813A, UNL_RT01, // Bootleg boards BTL_0353, BTL_09034A, BTL_2YUDB, BTL_900218, BTL_AISENSHINICOL, BTL_BATMANFS, BTL_CONTRAJ, BTL_DRAGONNINJA, BTL_L001, BTL_MARIOBABY, -- cgit v1.2.3