diff --git a/src/devices/bus/nes/pirate.cpp b/src/devices/bus/nes/pirate.cpp index 7b4bc04fef3..7e935b28901 100644 --- a/src/devices/bus/nes/pirate.cpp +++ b/src/devices/bus/nes/pirate.cpp @@ -43,7 +43,6 @@ DEFINE_DEVICE_TYPE(NES_DAOU306, nes_daou306_device, "nes_daou306", " DEFINE_DEVICE_TYPE(NES_CC21, nes_cc21_device, "nes_cc21", "NES Cart CC-21 PCB") DEFINE_DEVICE_TYPE(NES_XIAOZY, nes_xiaozy_device, "nes_xiaozy", "NES Cart Xiao Zhuan Yuan PCB") DEFINE_DEVICE_TYPE(NES_EDU2K, nes_edu2k_device, "nes_edu2k", "NES Cart Educational Computer 2000 PCB") -DEFINE_DEVICE_TYPE(NES_T230, nes_t230_device, "nes_t230", "NES Cart T-230 PCB") DEFINE_DEVICE_TYPE(NES_MK2, nes_mk2_device, "nes_mk2", "NES Cart Mortal Kombat 2 PCB") DEFINE_DEVICE_TYPE(NES_43272, nes_43272_device, "nes_43272", "NES Cart UNL-43272 PCB") DEFINE_DEVICE_TYPE(NES_EH8813A, nes_eh8813a_device, "nes_eh8813a", "NES Cart UNL-EH8813A PCB") @@ -94,11 +93,6 @@ nes_edu2k_device::nes_edu2k_device(const machine_config &mconfig, const char *ta { } -nes_t230_device::nes_t230_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : nes_nrom_device(mconfig, NES_T230, tag, owner, clock), m_irq_count(0), m_irq_count_latch(0), m_irq_mode(0), m_irq_enable(0), m_irq_enable_latch(0) -{ -} - nes_mk2_device::nes_mk2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : nes_nrom_device(mconfig, NES_MK2, tag, owner, clock), m_irq_count(0), m_irq_count_latch(0), m_irq_clear(0), m_irq_enable(0) { @@ -238,31 +232,6 @@ void nes_edu2k_device::pcb_reset() m_latch = 0; } -void nes_t230_device::device_start() -{ - common_start(); - save_item(NAME(m_irq_mode)); - save_item(NAME(m_irq_enable)); - save_item(NAME(m_irq_enable_latch)); - save_item(NAME(m_irq_count)); - save_item(NAME(m_irq_count_latch)); - save_item(NAME(m_mmc_vrom_bank)); -} - -void nes_t230_device::pcb_reset() -{ - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; - prg16_89ab(0); - prg16_cdef(m_prg_chunks - 1); - chr8(0, m_chr_source); - - m_irq_mode = 0; - m_irq_enable = m_irq_enable_latch = 0; - m_irq_count = m_irq_count_latch = 0; - - memset(m_mmc_vrom_bank, 0, sizeof(m_mmc_vrom_bank)); -} - void nes_mk2_device::device_start() { common_start(); @@ -676,80 +645,6 @@ uint8_t nes_edu2k_device::read_m(offs_t offset) return m_prgram[((m_latch * 0x2000) + offset) & (m_prgram.size() - 1)]; } -/*------------------------------------------------- - - Board UNL-T-230 - - Games: Dragon Ball Z IV (Unl) - - This mapper appears to be similar to Konami VRC-2 - but the game has no VROM and only 1 VRAM bank, so we - completely skip the chr bankswitch. If other games - using the same board and using CHR should surface, - we need to investigate this... - - In MESS: Supported - - -------------------------------------------------*/ - -// Identical to Konami IRQ -void nes_t230_device::hblank_irq(int scanline, int vblank, int blanked) -{ - /* Increment & check the IRQ scanline counter */ - if (m_irq_enable && (++m_irq_count == 0x100)) - { - m_irq_count = m_irq_count_latch; - m_irq_enable = m_irq_enable_latch; - hold_irq_line(); - } -} - -void nes_t230_device::write_h(offs_t offset, uint8_t data) -{ - LOG_MMC(("t230 write_h, offset: %04x, data: %02x\n", offset, data)); - - switch (offset & 0x700c) - { - case 0x0000: - break; - case 0x2000: - prg16_89ab(data); - break; - case 0x1000: - case 0x1004: - case 0x1008: - case 0x100c: - switch (data & 0x03) - { - case 0x00: set_nt_mirroring(PPU_MIRROR_VERT); break; - case 0x01: set_nt_mirroring(PPU_MIRROR_HORZ); break; - case 0x02: set_nt_mirroring(PPU_MIRROR_LOW); break; - case 0x03: set_nt_mirroring(PPU_MIRROR_HIGH); break; - } - break; - - case 0x7000: - m_irq_count_latch &= ~0x0f; - m_irq_count_latch |= data & 0x0f; - break; - case 0x7004: - m_irq_count_latch &= ~0xf0; - m_irq_count_latch |= (data << 4) & 0xf0; - break; - case 0x7008: - m_irq_mode = data & 0x04; // currently not implemented: 0 = prescaler mode / 1 = CPU mode - m_irq_enable = data & 0x02; - m_irq_enable_latch = data & 0x01; - if (data & 0x02) - m_irq_count = m_irq_count_latch; - break; - - default: - logerror("unl_t230_w uncaught offset: %04x value: %02x\n", offset, data); - break; - } -} - /*------------------------------------------------- Bootleg Board for MK2 diff --git a/src/devices/bus/nes/pirate.h b/src/devices/bus/nes/pirate.h index 87c1a96dc1c..2185387f71d 100644 --- a/src/devices/bus/nes/pirate.h +++ b/src/devices/bus/nes/pirate.h @@ -185,32 +185,6 @@ private: }; -// ======================> nes_t230_device - -class nes_t230_device : public nes_nrom_device -{ -public: - // construction/destruction - nes_t230_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 hblank_irq(int scanline, int vblank, int blanked) override; - virtual void pcb_reset() override; - -protected: - // device-level overrides - virtual void device_start() override; - -private: - uint16_t m_irq_count, m_irq_count_latch; - uint8_t m_irq_mode; - int m_irq_enable, m_irq_enable_latch; - - uint8_t m_mmc_vrom_bank[8]; -}; - - // ======================> nes_mk2_device class nes_mk2_device : public nes_nrom_device @@ -316,7 +290,6 @@ DECLARE_DEVICE_TYPE(NES_DAOU306, nes_daou306_device) DECLARE_DEVICE_TYPE(NES_CC21, nes_cc21_device) DECLARE_DEVICE_TYPE(NES_XIAOZY, nes_xiaozy_device) DECLARE_DEVICE_TYPE(NES_EDU2K, nes_edu2k_device) -DECLARE_DEVICE_TYPE(NES_T230, nes_t230_device) DECLARE_DEVICE_TYPE(NES_MK2, nes_mk2_device) DECLARE_DEVICE_TYPE(NES_43272, nes_43272_device) DECLARE_DEVICE_TYPE(NES_EH8813A, nes_eh8813a_device) diff --git a/src/devices/bus/nes/vrc_clones.cpp b/src/devices/bus/nes/vrc_clones.cpp index 88b311036c9..2a7bb80c53b 100644 --- a/src/devices/bus/nes/vrc_clones.cpp +++ b/src/devices/bus/nes/vrc_clones.cpp @@ -35,6 +35,7 @@ DEFINE_DEVICE_TYPE(NES_AX5705, nes_ax5705_device, "nes_ax5705", " DEFINE_DEVICE_TYPE(NES_BMC_830506C, nes_bmc_830506c_device, "nes_bmc_830506c", "NES Cart BMC 830506C PCB") DEFINE_DEVICE_TYPE(NES_CITYFIGHT, nes_cityfight_device, "nes_cityfight", "NES Cart City Fighter PCB") DEFINE_DEVICE_TYPE(NES_SHUIGUAN, nes_shuiguan_device, "nes_shuiguan", "NES Cart Shui Guan Pipe Pirate PCB") +DEFINE_DEVICE_TYPE(NES_T230, nes_t230_device, "nes_t230", "NES Cart T-230 PCB") DEFINE_DEVICE_TYPE(NES_TF1201, nes_tf1201_device, "nes_tf1201", "NES Cart UNL-TF1201 PCB") DEFINE_DEVICE_TYPE(NES_TH21311, nes_th21311_device, "nes_th21311", "NES Cart UNL-TH2131-1 PCB") @@ -74,6 +75,11 @@ nes_shuiguan_device::nes_shuiguan_device(const machine_config &mconfig, const ch { } +nes_t230_device::nes_t230_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_konami_vrc4_device(mconfig, NES_T230, tag, owner, clock) +{ +} + nes_tf1201_device::nes_tf1201_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : nes_konami_vrc4_device(mconfig, NES_TF1201, tag, owner, clock) { @@ -182,6 +188,15 @@ void nes_shuiguan_device::pcb_reset() m_reg = 0; } +void nes_t230_device::device_start() +{ + nes_konami_vrc4_device::device_start(); + + // VRC4 pins 3 and 4 + m_vrc_ls_prg_a = 3; // A3 + m_vrc_ls_prg_b = 2; // A2 +} + void nes_tf1201_device::device_start() { nes_konami_vrc4_device::device_start(); @@ -419,6 +434,43 @@ void nes_shuiguan_device::write_h(offs_t offset, u8 data) } } +/*------------------------------------------------- + + Board UNL-T-230 + + Games: Dragon Ball Z IV (Unl) + + VRC4 clone that uses CHRRAM instead of CHRROM and + has nonstandard PRG banking. + + NES 2.0: mapper 529 + + In MAME: Supported. + + TODO: This cart and its appearance on the 2yudb set + have IRQ timing issues that cause a bouncing status + bar in fights. Other emulators also have issues + on the split line so perhaps some noise is expected? + + -------------------------------------------------*/ + +void nes_t230_device::write_h(offs_t offset, u8 data) +{ + LOG_MMC(("t230 write_h, offset: %04x, data: %02x\n", offset, data)); + + switch (offset & 0x7000) + { + case 0x0000: + break; // PRG banking at $8000 ignored + case 0x2000: + prg16_89ab(data); + break; + default: + nes_konami_vrc4_device::write_h(offset, data); + break; + } +} + /*------------------------------------------------- UNL-TF1201 diff --git a/src/devices/bus/nes/vrc_clones.h b/src/devices/bus/nes/vrc_clones.h index b86706af340..c339ae4fad1 100644 --- a/src/devices/bus/nes/vrc_clones.h +++ b/src/devices/bus/nes/vrc_clones.h @@ -152,6 +152,22 @@ private: }; +// ======================> nes_t230_device + +class nes_t230_device : public nes_konami_vrc4_device +{ +public: + // construction/destruction + nes_t230_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual void write_h(offs_t offset, u8 data) override; + +protected: + // device-level overrides + virtual void device_start() override; +}; + + // ======================> nes_tf1201_device class nes_tf1201_device : public nes_konami_vrc4_device @@ -203,6 +219,7 @@ DECLARE_DEVICE_TYPE(NES_AX5705, nes_ax5705_device) DECLARE_DEVICE_TYPE(NES_BMC_830506C, nes_bmc_830506c_device) DECLARE_DEVICE_TYPE(NES_CITYFIGHT, nes_cityfight_device) DECLARE_DEVICE_TYPE(NES_SHUIGUAN, nes_shuiguan_device) +DECLARE_DEVICE_TYPE(NES_T230, nes_t230_device) DECLARE_DEVICE_TYPE(NES_TF1201, nes_tf1201_device) DECLARE_DEVICE_TYPE(NES_TH21311, nes_th21311_device)