diff options
author | 2021-09-10 01:08:44 -0800 | |
---|---|---|
committer | 2021-09-10 01:41:12 -0800 | |
commit | c05c9603bebfa2f1d301e0900b6806a2144a7311 (patch) | |
tree | c8a2ae70a0b98608d1df43f8662f50e989d77826 | |
parent | 968fb7f491a1eab76034b8a4fe14ad1f32060a88 (diff) |
Converted Chinese Ninja Ryukenden to MMC1 subclass.
-rw-r--r-- | src/devices/bus/nes/mmc1_clones.cpp | 30 | ||||
-rw-r--r-- | src/devices/bus/nes/mmc1_clones.h | 17 | ||||
-rw-r--r-- | src/devices/bus/nes/pirate.cpp | 96 | ||||
-rw-r--r-- | src/devices/bus/nes/pirate.h | 24 |
4 files changed, 47 insertions, 120 deletions
diff --git a/src/devices/bus/nes/mmc1_clones.cpp b/src/devices/bus/nes/mmc1_clones.cpp index 5d813cd36d3..eb5b7d937ab 100644 --- a/src/devices/bus/nes/mmc1_clones.cpp +++ b/src/devices/bus/nes/mmc1_clones.cpp @@ -28,10 +28,16 @@ // constructor //------------------------------------------------- +DEFINE_DEVICE_TYPE(NES_NINJARYU, nes_ninjaryu_device, "nes_ninjaryu", "NES Cart Ninja Ryukenden Chinese PCB") DEFINE_DEVICE_TYPE(NES_RESETSXROM, nes_resetsxrom_device, "nes_resetsxrom", "NES Cart BMC RESET-SXROM PCB") DEFINE_DEVICE_TYPE(NES_TXC_22110, nes_txc_22110_device, "nes_txc_22110", "NES Cart TXC 01-22110-000 PCB") +nes_ninjaryu_device::nes_ninjaryu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_sxrom_device(mconfig, NES_NINJARYU, tag, owner, clock) +{ +} + nes_resetsxrom_device::nes_resetsxrom_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : nes_sxrom_device(mconfig, NES_RESETSXROM, tag, owner, clock), m_reset_count(-1) { @@ -81,6 +87,30 @@ void nes_txc_22110_device::pcb_reset() /*------------------------------------------------- + UNL-NINJARYU + + Games: Ninja Ryukenden Chinese + + This board was previously assigned to mapper 111. It has + registers akin to MMC1 but without the need to write to + them serially. The one existing game has 256K CHR, so this + must have at least 1 more bit for CHR banking. Other differences? + + In MAME: Preliminary supported. + + -------------------------------------------------*/ + +void nes_ninjaryu_device::write_h(offs_t offset, u8 data) +{ + LOG_MMC(("unl_ninjaryu write_h, offset: %04x, data: %02x\n", offset, data)); + u8 reg = (offset >> 13) & 0x03; + m_reg[reg] = data; + update_regs(reg); +} + + +/*------------------------------------------------- + MULTIGAME CARTS BASED ON MMC1 -------------------------------------------------*/ diff --git a/src/devices/bus/nes/mmc1_clones.h b/src/devices/bus/nes/mmc1_clones.h index 01fd2ac805d..310dfb7c098 100644 --- a/src/devices/bus/nes/mmc1_clones.h +++ b/src/devices/bus/nes/mmc1_clones.h @@ -8,6 +8,22 @@ #include "mmc1.h" +// ======================> nes_ninjaryu_device + +class nes_ninjaryu_device : public nes_sxrom_device +{ +public: + // construction/destruction + nes_ninjaryu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual void write_h(offs_t offset, u8 data) override; + +protected: + virtual void set_prg() override { nes_sxrom_device::set_prg(0x00, 0x0f); } + virtual void set_chr() override { nes_sxrom_device::set_chr(0x00, 0x3f); } +}; + + // ======================> nes_resetsxrom_device class nes_resetsxrom_device : public nes_sxrom_device @@ -57,6 +73,7 @@ private: // device type definition +DECLARE_DEVICE_TYPE(NES_NINJARYU, nes_ninjaryu_device) DECLARE_DEVICE_TYPE(NES_RESETSXROM, nes_resetsxrom_device) DECLARE_DEVICE_TYPE(NES_TXC_22110, nes_txc_22110_device) diff --git a/src/devices/bus/nes/pirate.cpp b/src/devices/bus/nes/pirate.cpp index 81acd4dc55d..c6a68d48b98 100644 --- a/src/devices/bus/nes/pirate.cpp +++ b/src/devices/bus/nes/pirate.cpp @@ -49,7 +49,6 @@ DEFINE_DEVICE_TYPE(NES_WHERO, nes_whero_device, "nes_whero", " DEFINE_DEVICE_TYPE(NES_43272, nes_43272_device, "nes_43272", "NES Cart UNL-43272 PCB") DEFINE_DEVICE_TYPE(NES_TF1201, nes_tf1201_device, "nes_tf1201", "NES Cart UNL-TF1201 PCB") DEFINE_DEVICE_TYPE(NES_CITYFIGHT, nes_cityfight_device, "nes_cityfight", "NES Cart City Fighter PCB") -DEFINE_DEVICE_TYPE(NES_NINJARYU, nes_ninjaryu_device, "nes_ninjaryu", "NES Cart Ninja Ryukenden Chinese PCB") DEFINE_DEVICE_TYPE(NES_EH8813A, nes_eh8813a_device, "nes_eh8813a", "NES Cart UNL-EH8813A PCB") @@ -128,11 +127,6 @@ nes_cityfight_device::nes_cityfight_device(const machine_config &mconfig, const { } -nes_ninjaryu_device::nes_ninjaryu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : nes_nrom_device(mconfig, NES_NINJARYU, tag, owner, clock) -{ -} - nes_eh8813a_device::nes_eh8813a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : nes_nrom_device(mconfig, NES_EH8813A, tag, owner, clock), m_dipsetting(0), m_latch(0) { @@ -405,22 +399,6 @@ void nes_cityfight_device::pcb_reset() m_irq_count = 0; } -void nes_ninjaryu_device::device_start() -{ - common_start(); - save_item(NAME(m_reg)); -} - -void nes_ninjaryu_device::pcb_reset() -{ - m_reg[0] = 0x0f; - m_reg[1] = m_reg[2] = m_reg[3] = 0; - - set_nt_mirroring(PPU_MIRROR_HORZ); - update_prg(); - update_chr(); -} - void nes_eh8813a_device::device_start() { common_start(); @@ -1256,80 +1234,6 @@ void nes_cityfight_device::write_h(offs_t offset, uint8_t data) } } - -/*------------------------------------------------- - - UNL-NINJARYU - - Games: Ninja Ryukenden Chinese - - This board is mentioned on the NesDev page describing - mapper 111, which used to be assigned to this. It has - registers similar to MMC1 but without the need to write to - them serially. The one existing game has 256K CHR, so this - must have at least 1 more bit for CHR banking. Other differences? - - In MAME: Preliminary supported. - - -------------------------------------------------*/ - -void nes_ninjaryu_device::update_prg() -{ - if (!BIT(m_reg[0], 3)) - prg32((m_reg[3] >> 1) & 0x07); // 32K mode - else if (BIT(m_reg[0], 2)) - { - prg16_89ab(m_reg[3] & 0x0f); - prg16_cdef(m_prg_chunks - 1); // 16K mode fixed last bank - } - else - { - prg16_89ab(0); // 16K mode fixed first bank - prg16_cdef(m_reg[3] & 0x0f); - } -} - -void nes_ninjaryu_device::update_chr() -{ - if (BIT(m_reg[0], 4)) - { - chr4_0(m_reg[1], CHRROM); - chr4_4(m_reg[2], CHRROM); - } - else - chr8(m_reg[1] >> 1, CHRROM); -} - -void nes_ninjaryu_device::write_h(offs_t offset, uint8_t data) -{ - LOG_MMC(("unl_ninjaryu write_h, offset: %04x, data: %02x\n", offset, data)); - - m_reg[(offset >> 13) & 0x03] = data & 0x3f; - - switch (offset & 0x6000) - { - case 0x0000: - switch (data & 0x03) - { - case 0x00: set_nt_mirroring(PPU_MIRROR_LOW); break; - case 0x01: set_nt_mirroring(PPU_MIRROR_HIGH); break; - case 0x02: set_nt_mirroring(PPU_MIRROR_VERT); break; - case 0x03: set_nt_mirroring(PPU_MIRROR_HORZ); break; - } - update_prg(); - update_chr(); - break; - case 0x2000: - case 0x4000: - update_chr(); - break; - case 0x6000: - update_prg(); - break; - } -} - - /*------------------------------------------------- UNL-EH8813A diff --git a/src/devices/bus/nes/pirate.h b/src/devices/bus/nes/pirate.h index b98dc8d8a8b..4b0e1f1ae61 100644 --- a/src/devices/bus/nes/pirate.h +++ b/src/devices/bus/nes/pirate.h @@ -343,29 +343,6 @@ private: }; -// ======================> nes_ninjaryu_device - -class nes_ninjaryu_device : public nes_nrom_device -{ -public: - // construction/destruction - nes_ninjaryu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - virtual void write_h(offs_t offset, uint8_t data) override; - - virtual void pcb_reset() override; - -protected: - // device-level overrides - virtual void device_start() override; - -private: - void update_prg(); - void update_chr(); - uint8_t m_reg[4]; -}; - - // ======================> nes_eh8813a_device class nes_eh8813a_device : public nes_nrom_device @@ -429,7 +406,6 @@ DECLARE_DEVICE_TYPE(NES_WHERO, nes_whero_device) DECLARE_DEVICE_TYPE(NES_43272, nes_43272_device) DECLARE_DEVICE_TYPE(NES_TF1201, nes_tf1201_device) DECLARE_DEVICE_TYPE(NES_CITYFIGHT, nes_cityfight_device) -DECLARE_DEVICE_TYPE(NES_NINJARYU, nes_ninjaryu_device) DECLARE_DEVICE_TYPE(NES_EH8813A, nes_eh8813a_device) //DECLARE_DEVICE_TYPE(NES_FUJIYA, nes_fujiya_device) |