From 317b122ecb1a4d9a4d07ca44ae751638f688572c Mon Sep 17 00:00:00 2001 From: 0kmg <9137159+0kmg@users.noreply.github.com> Date: Sun, 17 Oct 2021 07:45:09 -0800 Subject: [PATCH] bus/nes: Continued work on VRC4 and clone boards. (#8713) - Tweaked VRC4 class to make it easier to extend for clones and multicarts. The main new pieces are: a centralized and more flexible function for PRG banking and an overridable IRQ acknowledge function. - Added support for 830506C board. - Added support for unknown board for Yu Yu Hakusho/Dragon Ball Z 2-in-1. - Made a small simplification to TF1201 using new IRQ function. New working software list additions (nes.xml) ----------------------------------- 1994 Super HiK 4 in 1 (JY-005) [famiac, NewRisingSun] Software list items promoted to working (nes.xml) --------------------------------------- 2 in 1 - Yu Yu + Dragonball Z --- hash/nes.xml | 22 ++++- src/devices/bus/nes/konami.cpp | 102 ++++++++++------------- src/devices/bus/nes/konami.h | 20 +++-- src/devices/bus/nes/nes_carts.cpp | 4 +- src/devices/bus/nes/nes_ines.hxx | 4 +- src/devices/bus/nes/nes_pcb.hxx | 2 + src/devices/bus/nes/nes_slot.h | 8 +- src/devices/bus/nes/vrc_clones.cpp | 129 +++++++++++++++++++++++++---- src/devices/bus/nes/vrc_clones.h | 67 +++++++++++++-- 9 files changed, 257 insertions(+), 101 deletions(-) diff --git a/hash/nes.xml b/hash/nes.xml index d622035382c..afa0d1c6819 100644 --- a/hash/nes.xml +++ b/hash/nes.xml @@ -51806,6 +51806,21 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx + + 1994 Super HiK 4 in 1 (JY-005) + 1994 + J.Y. Company + + + + + + + + + + + 1994 Super HiK 3 in 1 (JY-007) 1994 @@ -62295,14 +62310,12 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx - - + 2 in 1 - Yu Yu + Dragonball Z 19?? <pirate> - - + @@ -62746,6 +62759,7 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx + Batman - The Video Game (Brazil, pirate) 1992? diff --git a/src/devices/bus/nes/konami.cpp b/src/devices/bus/nes/konami.cpp index e2389c34662..bae7ec4ca9d 100644 --- a/src/devices/bus/nes/konami.cpp +++ b/src/devices/bus/nes/konami.cpp @@ -70,12 +70,12 @@ nes_konami_vrc3_device::nes_konami_vrc3_device(const machine_config &mconfig, co { } -nes_konami_vrc4_device::nes_konami_vrc4_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) - : nes_nrom_device(mconfig, type, tag, owner, clock), m_latch(0), m_mmc_prg_bank(0), m_irq_count(0), m_irq_count_latch(0), m_irq_enable(0), m_irq_enable_latch(0), m_irq_mode(0), m_irq_prescale(0), irq_timer(nullptr) +nes_konami_vrc4_device::nes_konami_vrc4_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) + : nes_nrom_device(mconfig, type, tag, owner, clock), m_prg_flip(0), m_irq_count(0), m_irq_count_latch(0), m_irq_enable(0), m_irq_enable_latch(0), m_irq_mode(0), m_irq_prescale(0), irq_timer(nullptr) { } -nes_konami_vrc4_device::nes_konami_vrc4_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +nes_konami_vrc4_device::nes_konami_vrc4_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : nes_konami_vrc4_device(mconfig, NES_VRC4, tag, owner, clock) { } @@ -166,7 +166,7 @@ void nes_konami_vrc4_device::device_start() save_item(NAME(m_irq_enable_latch)); save_item(NAME(m_irq_count)); save_item(NAME(m_irq_count_latch)); - save_item(NAME(m_latch)); + save_item(NAME(m_prg_flip)); save_item(NAME(m_mmc_prg_bank)); save_item(NAME(m_mmc_vrom_bank)); } @@ -174,8 +174,6 @@ void nes_konami_vrc4_device::device_start() void nes_konami_vrc4_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; @@ -185,9 +183,11 @@ void nes_konami_vrc4_device::pcb_reset() m_irq_count = 0; m_irq_count_latch = 0; - m_latch = 0; - m_mmc_prg_bank = 0; - memset(m_mmc_vrom_bank, 0, sizeof(m_mmc_vrom_bank)); + m_prg_flip = 0; + m_mmc_prg_bank[0] = 0; + m_mmc_prg_bank[1] = 0; + set_prg(); + std::fill(std::begin(m_mmc_vrom_bank), std::end(m_mmc_vrom_bank), 0x00); } void nes_konami_vrc6_device::device_start() @@ -427,7 +427,7 @@ void nes_konami_vrc3_device::write_h(offs_t offset, uint8_t data) Konami VRC-4 - In MESS: Supported + In MAME: Supported -------------------------------------------------*/ @@ -467,7 +467,13 @@ void nes_konami_vrc4_device::device_timer(emu_timer &timer, device_timer_id id, } } -void nes_konami_vrc4_device::irq_ctrl_w(uint8_t data) +void nes_konami_vrc4_device::irq_ack_w() +{ + m_irq_enable = m_irq_enable_latch; + set_irq_line(CLEAR_LINE); +} + +void nes_konami_vrc4_device::irq_ctrl_w(u8 data) { m_irq_mode = data & 0x04; m_irq_enable = data & 0x02; @@ -480,51 +486,46 @@ void nes_konami_vrc4_device::irq_ctrl_w(uint8_t data) set_irq_line(CLEAR_LINE); } -void nes_konami_vrc4_device::set_prg() +void nes_konami_vrc4_device::set_mirror(u8 data) { - if (m_latch & 0x02) + switch (data & 0x03) { - prg8_89(0xfe); - prg8_cd(m_mmc_prg_bank); - } - else - { - prg8_89(m_mmc_prg_bank); - prg8_cd(0xfe); + 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; } } -void nes_konami_vrc4_device::write_h(offs_t offset, uint8_t data) +void nes_konami_vrc4_device::set_prg(int prg_base, int prg_mask) +{ + prg8_x(0 ^ m_prg_flip, prg_base | (m_mmc_prg_bank[0] & prg_mask)); + prg8_x(1, prg_base | (m_mmc_prg_bank[1] & prg_mask)); + prg8_x(2 ^ m_prg_flip, prg_base | (prg_mask & ~1)); + prg8_x(3, prg_base | prg_mask); +} + +void nes_konami_vrc4_device::write_h(offs_t offset, u8 data) { int bank, shift, mask; - uint16_t add_lines = ((offset << (9 - m_vrc_ls_prg_a)) & 0x200) | ((offset << (8 - m_vrc_ls_prg_b)) & 0x100); + u16 add_lines = ((offset << (9 - m_vrc_ls_prg_a)) & 0x200) | ((offset << (8 - m_vrc_ls_prg_b)) & 0x100); LOG_MMC(("VRC-4 write_h, offset: %04x, data: %02x\n", offset, data)); switch (offset & 0x7000) { case 0x0000: - m_mmc_prg_bank = data; - set_prg(); - break; case 0x2000: - prg8_ab(data); + m_mmc_prg_bank[BIT(offset, 13)] = data; + set_prg(); break; case 0x1000: if (add_lines & 0x200) { - m_latch = data & 0x02; + m_prg_flip = data & 0x02; set_prg(); } else - { - 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; - } - } + set_mirror(data); break; case 0x3000: case 0x4000: @@ -534,7 +535,7 @@ void nes_konami_vrc4_device::write_h(offs_t offset, uint8_t data) shift = BIT(add_lines, 8) * 4; mask = shift ? 0x1f0 : 0x0f; m_mmc_vrom_bank[bank] = (m_mmc_vrom_bank[bank] & ~mask) | ((data << shift) & mask); - chr1_x(bank, m_mmc_vrom_bank[bank], CHRROM); + chr1_x(bank, m_mmc_vrom_bank[bank], m_chr_source); break; case 0x7000: switch (add_lines) @@ -549,8 +550,7 @@ void nes_konami_vrc4_device::write_h(offs_t offset, uint8_t data) irq_ctrl_w(data); break; case 0x300: - m_irq_enable = m_irq_enable_latch; - set_irq_line(CLEAR_LINE); + irq_ack_w(); break; } break; @@ -591,15 +591,7 @@ void nes_konami_vrc6_device::write_h(offs_t offset, uint8_t data) break; case 0x3000: if (add_lines == 0x300) - { - switch (data & 0x0c) - { - case 0x00: set_nt_mirroring(PPU_MIRROR_VERT); break; - case 0x04: set_nt_mirroring(PPU_MIRROR_HORZ); break; - case 0x08: set_nt_mirroring(PPU_MIRROR_LOW); break; - case 0x0c: set_nt_mirroring(PPU_MIRROR_HIGH); break; - } - } + set_mirror(data >> 2); else // saw m_vrc6snd->write((add_lines>>8) | 0x200, data); break; @@ -618,8 +610,7 @@ void nes_konami_vrc6_device::write_h(offs_t offset, uint8_t data) irq_ctrl_w(data); break; case 0x200: - m_irq_enable = m_irq_enable_latch; - set_irq_line(CLEAR_LINE); + irq_ack_w(); break; default: logerror("VRC-6 write_h uncaught write, addr: %04x value: %02x\n", ((offset & 0x7000) | add_lines) + 0x8000, data); @@ -709,13 +700,7 @@ void nes_konami_vrc7_device::write_h(offs_t offset, uint8_t data) break; case 0x6000: - 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; - } + set_mirror(data); break; case 0x6008: case 0x6010: case 0x6018: m_irq_count_latch = data; @@ -724,8 +709,7 @@ void nes_konami_vrc7_device::write_h(offs_t offset, uint8_t data) irq_ctrl_w(data); break; case 0x7008: case 0x7010: case 0x7018: - m_irq_enable = m_irq_enable_latch; - set_irq_line(CLEAR_LINE); + irq_ack_w(); break; default: diff --git a/src/devices/bus/nes/konami.h b/src/devices/bus/nes/konami.h index 03c44948e7e..88f477cc4ea 100644 --- a/src/devices/bus/nes/konami.h +++ b/src/devices/bus/nes/konami.h @@ -92,28 +92,32 @@ class nes_konami_vrc4_device : public nes_nrom_device { public: // construction/destruction - nes_konami_vrc4_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + nes_konami_vrc4_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - virtual void write_h(offs_t offset, uint8_t data) override; + virtual void write_h(offs_t offset, u8 data) override; virtual void pcb_reset() override; protected: static constexpr device_timer_id TIMER_IRQ = 0; - nes_konami_vrc4_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + nes_konami_vrc4_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); // device-level overrides virtual void device_start() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - void set_prg(); - uint16_t m_mmc_vrom_bank[8]; - uint8_t m_latch, m_mmc_prg_bank; + void set_mirror(u8 data); + void set_prg(int prg_base, int prg_mask); + virtual void set_prg() { set_prg(0x00, 0x1f); } + u16 m_mmc_vrom_bank[8]; + u8 m_mmc_prg_bank[2]; + u8 m_prg_flip; void irq_tick(); - void irq_ctrl_w(uint8_t data); - uint8_t m_irq_count, m_irq_count_latch; + virtual void irq_ack_w(); + void irq_ctrl_w(u8 data); + u8 m_irq_count, m_irq_count_latch; int m_irq_enable, m_irq_enable_latch; int m_irq_mode; int m_irq_prescale; diff --git a/src/devices/bus/nes/nes_carts.cpp b/src/devices/bus/nes/nes_carts.cpp index 604cb66a90d..cd4a09cf180 100644 --- a/src/devices/bus/nes/nes_carts.cpp +++ b/src/devices/bus/nes/nes_carts.cpp @@ -315,6 +315,7 @@ void nes_cart(device_slot_interface &device) device.option_add_internal("smb2jb", NES_SMB2JB); device.option_add_internal("yung08", NES_YUNG08); device.option_add_internal("btl_0353", NES_0353); // used by Lucky (Roger) Rabbit FDS conversion + device.option_add_internal("btl_2yudb", NES_2YUDB); device.option_add_internal("btl_900218", NES_900218); device.option_add_internal("09034a", NES_09034A); device.option_add_internal("l001", NES_L001); @@ -380,8 +381,9 @@ void nes_cart(device_slot_interface &device) device.option_add_internal("bmc_60311c", NES_BMC_60311C); device.option_add_internal("bmc_80013b", NES_BMC_80013B); device.option_add_internal("bmc_810544c", NES_BMC_810544C); - device.option_add_internal("bmc_830928c", NES_BMC_830928C); device.option_add_internal("bmc_830425c", NES_BMC_830425C); + device.option_add_internal("bmc_830506c", NES_BMC_830506C); + device.option_add_internal("bmc_830928c", NES_BMC_830928C); device.option_add_internal("bmc_850437c", NES_BMC_850437C); device.option_add_internal("bmc_970630c", NES_BMC_970630C); device.option_add_internal("bmc_jy820845c", NES_BMC_JY820845C); diff --git a/src/devices/bus/nes/nes_ines.hxx b/src/devices/bus/nes/nes_ines.hxx index 52a2b0ce605..5ef4994b593 100644 --- a/src/devices/bus/nes/nes_ines.hxx +++ b/src/devices/bus/nes/nes_ines.hxx @@ -397,7 +397,7 @@ static const nes_mmc mmc_list[] = // 359 BMC-SB-5013 multicarts // 360 Bit Corp 31-in-1 (ID 3150) (has five accessible DIP switches!) { 361, BMC_YY841101C }, - // 362 JY-005 multicart + { 362, BMC_830506C }, // 363 variant of mapper 358? { 364, BMC_830832C }, // 365 is this asderp95 in nes.xml? @@ -483,7 +483,7 @@ static const nes_mmc mmc_list[] = // 517 another Korean karaoke cart with mic // 518 Subor UNL-DANCE2000 and a few others { 519, UNL_EH8813A }, // Dr Mario II Chinese pirate - // { 520, UNKNOWN }, this is probably 2yudb + { 520, BTL_2YUDB }, { 521, DREAMTECH_BOARD }, // Korean Igo { 522, UNL_LH10 }, // Fuuun Shaolin Kyo FDS conversion // { 523, UNKNOWN }, likely fengshnb or a clone not yet in nes.xml diff --git a/src/devices/bus/nes/nes_pcb.hxx b/src/devices/bus/nes/nes_pcb.hxx index 4af5d15e90b..34bbc008cf7 100644 --- a/src/devices/bus/nes/nes_pcb.hxx +++ b/src/devices/bus/nes/nes_pcb.hxx @@ -217,6 +217,7 @@ static const nes_pcb pcb_list[] = { "smb2jb", BTL_SMB2JB }, { "yung08", BTL_YUNG08 }, { "btl_0353", BTL_0353 }, + { "btl_2yudb", BTL_2YUDB }, { "btl_900218", BTL_900218 }, // pirate The Lord of King { "09034a", BTL_09034A }, { "l001", BTL_L001 }, @@ -261,6 +262,7 @@ static const nes_pcb pcb_list[] = { "bmc_80013b", BMC_80013B }, { "bmc_810544c", BMC_810544C }, { "bmc_830425c", BMC_830425C }, + { "bmc_830506c", BMC_830506C }, { "bmc_830928c", BMC_830928C }, { "bmc_850437c", BMC_850437C }, { "bmc_970630c", BMC_970630C }, diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h index 6ac74ca1f63..64345ca3e60 100644 --- a/src/devices/bus/nes/nes_slot.h +++ b/src/devices/bus/nes/nes_slot.h @@ -97,7 +97,7 @@ enum BMC_GKA, BMC_GKB, BMC_GKCXIN1, BMC_GN91B, BMC_HP898F, BMC_VT5201, BMC_BENSHIENG, BMC_60311C, BMC_80013B, BMC_810544C, BMC_830425C, - BMC_830928C, BMC_850437C, BMC_970630C, + BMC_830506C, BMC_830928C, BMC_850437C, BMC_970630C, BMC_N32_4IN1, BMC_NC20MB, BMC_NT639, BMC_NTD_03, BMC_SRPG_5IN1, BMC_EL860947C, BMC_EL861121C, BMC_FK23C, BMC_FK23CA, BMC_JY820845C, BMC_PJOY84, BMC_TH22913, BMC_11160, BMC_G146, @@ -111,14 +111,14 @@ enum // Unlicensed UNL_8237, UNL_8237A, UNL_CC21, UNL_AX40G, UNL_AX5705, UNL_KN42, UNL_KOF97, UNL_N625092, UNL_SC127, UNL_SMB2J, UNL_T230, UNL_MMALEE, - UNL_UXROM, UNL_MK2, UNL_XIAOZY, UNL_KOF96, UNL_FS6, + UNL_MK2, UNL_XIAOZY, UNL_KOF96, UNL_FS6, 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, // Bootleg boards - BTL_0353, BTL_09034A, BTL_900218, BTL_AISENSHINICOL, BTL_BATMANFS, - BTL_CONTRAJ, BTL_DRAGONNINJA, BTL_L001, BTL_MARIOBABY, + BTL_0353, BTL_09034A, BTL_2YUDB, BTL_900218, BTL_AISENSHINICOL, + BTL_BATMANFS, BTL_CONTRAJ, BTL_DRAGONNINJA, BTL_L001, BTL_MARIOBABY, BTL_PALTHENA, BTL_PIKACHUY2K, BTL_SBROS11, BTL_SHUIGUAN, BTL_SMB2JA, BTL_SMB2JB, BTL_SMB3, BTL_TOBIDASE, BTL_YUNG08, // Shenzhen Jncota diff --git a/src/devices/bus/nes/vrc_clones.cpp b/src/devices/bus/nes/vrc_clones.cpp index 5b373db74b5..88b311036c9 100644 --- a/src/devices/bus/nes/vrc_clones.cpp +++ b/src/devices/bus/nes/vrc_clones.cpp @@ -28,15 +28,22 @@ // constructor //------------------------------------------------- -DEFINE_DEVICE_TYPE(NES_900218, nes_900218_device, "nes_900218", "NES Cart 900218 PCB") -DEFINE_DEVICE_TYPE(NES_AX40G, nes_ax40g_device, "nes_ax40g", "NES Cart UNL-AX-40G PCB") -DEFINE_DEVICE_TYPE(NES_AX5705, nes_ax5705_device, "nes_ax5705", "NES Cart AX5705 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_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") +DEFINE_DEVICE_TYPE(NES_2YUDB, nes_2yudb_device, "nes_2yudb", "NES Cart Yu Yu Hakusho - Dragon Ball Z 2 in 1 PCB") +DEFINE_DEVICE_TYPE(NES_900218, nes_900218_device, "nes_900218", "NES Cart 900218 PCB") +DEFINE_DEVICE_TYPE(NES_AX40G, nes_ax40g_device, "nes_ax40g", "NES Cart UNL-AX-40G PCB") +DEFINE_DEVICE_TYPE(NES_AX5705, nes_ax5705_device, "nes_ax5705", "NES Cart AX5705 PCB") +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_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") +nes_2yudb_device::nes_2yudb_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_konami_vrc4_device(mconfig, NES_2YUDB, tag, owner, clock), m_outer(0) +{ +} + nes_900218_device::nes_900218_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : nes_konami_vrc2_device(mconfig, NES_900218, tag, owner, clock), m_irq_count(0), m_irq_enable(0), irq_timer(nullptr) { @@ -52,6 +59,11 @@ nes_ax5705_device::nes_ax5705_device(const machine_config &mconfig, const char * { } +nes_bmc_830506c_device::nes_bmc_830506c_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_konami_vrc4_device(mconfig, NES_BMC_830506C, tag, owner, clock), m_outer(0) +{ +} + nes_cityfight_device::nes_cityfight_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : nes_konami_vrc4_device(mconfig, NES_CITYFIGHT, tag, owner, clock) { @@ -74,6 +86,22 @@ nes_th21311_device::nes_th21311_device(const machine_config &mconfig, const char +void nes_2yudb_device::device_start() +{ + nes_konami_vrc4_device::device_start(); + save_item(NAME(m_outer)); + + // VRC4 pins 3 and 4 + m_vrc_ls_prg_a = 3; // A3 + m_vrc_ls_prg_b = 2; // A2 +} + +void nes_2yudb_device::pcb_reset() +{ + m_outer = 0; + nes_konami_vrc4_device::pcb_reset(); +} + void nes_900218_device::device_start() { nes_konami_vrc2_device::device_start(); @@ -113,6 +141,22 @@ void nes_ax5705_device::device_start() m_vrc_ls_prg_b = 0; // A0 } +void nes_bmc_830506c_device::device_start() +{ + nes_konami_vrc4_device::device_start(); + save_item(NAME(m_outer)); + + // VRC4 pins 3 and 4 + m_vrc_ls_prg_a = 1; // A1 + m_vrc_ls_prg_b = 0; // A0 +} + +void nes_bmc_830506c_device::pcb_reset() +{ + m_outer = 0; + nes_konami_vrc4_device::pcb_reset(); +} + void nes_cityfight_device::device_start() { nes_konami_vrc4_device::device_start(); @@ -391,14 +435,9 @@ void nes_shuiguan_device::write_h(offs_t offset, u8 data) -------------------------------------------------*/ -void nes_tf1201_device::write_h(offs_t offset, u8 data) +void nes_tf1201_device::irq_ack_w() { - LOG_MMC(("unl_tf1201 write_h, offset: %04x, data: %02x\n", offset, data)); - - if ((offset & 0x7003) == 0x7003) - set_irq_line(CLEAR_LINE); - else - nes_konami_vrc4_device::write_h(offset, data); + set_irq_line(CLEAR_LINE); } /*------------------------------------------------- @@ -463,3 +502,65 @@ void nes_th21311_device::write_h(offs_t offset, u8 data) MULTIGAME CARTS BASED ON VRC -------------------------------------------------*/ + +/*------------------------------------------------- + + Board BTL-2YUDB + + Games: 2 in 1 Datach Yu Yu Hakusho + Dragon Ball Z + + VRC4 clone that uses CHRRAM instead of the usual + CHRROM and has a bit for selecting the outer PRG bank. + + NES 2.0: mapper 520 + + In MAME: Supported. + + -------------------------------------------------*/ + +void nes_2yudb_device::write_h(offs_t offset, u8 data) +{ + LOG_MMC(("2yudb write_h, offset: %04x, data: %02x\n", offset, data)); + + nes_konami_vrc4_device::write_h(offset, data); + + if (offset >= 0x3000 && offset < 0x7000 && !BIT(offset, m_vrc_ls_prg_b)) + { + u8 bank = ((offset >> 12) - 3) * 2 + BIT(offset, m_vrc_ls_prg_a); + m_outer = (m_mmc_vrom_bank[bank] & 0x08) << 2; + set_prg(); + } +} + +/*------------------------------------------------- + + Board BMC-830506C + + Games: 1995 Super HiK 4 in 1 (JY-005) + + VRC4 clone with banking for multicart menu. + + NES 2.0: mapper 362 + + In MAME: Supported. + + -------------------------------------------------*/ + +void nes_bmc_830506c_device::irq_ack_w() +{ + set_irq_line(CLEAR_LINE); +} + +void nes_bmc_830506c_device::write_h(offs_t offset, u8 data) +{ + LOG_MMC(("bmc_830506c write_h, offset: %04x, data: %02x\n", offset, data)); + + nes_konami_vrc4_device::write_h(offset, data); + + if (offset >= 0x3000 && offset < 0x7000 && BIT(offset, m_vrc_ls_prg_b)) + { + u8 bank = ((offset >> 12) - 3) * 2 + BIT(offset, m_vrc_ls_prg_a); + m_outer = (m_mmc_vrom_bank[bank] & 0x180) >> 3; + set_prg(); + } +} diff --git a/src/devices/bus/nes/vrc_clones.h b/src/devices/bus/nes/vrc_clones.h index 1e479139f9f..b86706af340 100644 --- a/src/devices/bus/nes/vrc_clones.h +++ b/src/devices/bus/nes/vrc_clones.h @@ -8,6 +8,29 @@ #include "konami.h" +// ======================> nes_2yudb_device + +class nes_2yudb_device : public nes_konami_vrc4_device +{ +public: + // construction/destruction + nes_2yudb_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual void write_h(offs_t offset, u8 data) override; + + virtual void pcb_reset() override; + +protected: + // device-level overrides + virtual void device_start() override; + + virtual void set_prg() override { nes_konami_vrc4_device::set_prg(m_outer, 0x1f); } + +private: + u8 m_outer; +}; + + // ======================> nes_900218_device class nes_900218_device : public nes_konami_vrc2_device @@ -66,6 +89,30 @@ protected: }; +// ======================> nes_bmc_830506c_device + +class nes_bmc_830506c_device : public nes_konami_vrc4_device +{ +public: + // construction/destruction + nes_bmc_830506c_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual void write_h(offs_t offset, u8 data) override; + + virtual void pcb_reset() override; + +protected: + // device-level overrides + virtual void device_start() override; + + virtual void irq_ack_w() override; + virtual void set_prg() override { nes_konami_vrc4_device::set_prg(m_outer, 0x0f); } + +private: + u8 m_outer; +}; + + // ======================> nes_cityfight_device class nes_cityfight_device : public nes_konami_vrc4_device @@ -113,11 +160,11 @@ public: // construction/destruction nes_tf1201_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; + + virtual void irq_ack_w() override; }; @@ -149,12 +196,14 @@ private: // device type definition -DECLARE_DEVICE_TYPE(NES_900218, nes_900218_device) -DECLARE_DEVICE_TYPE(NES_AX40G, nes_ax40g_device) -DECLARE_DEVICE_TYPE(NES_AX5705, nes_ax5705_device) -DECLARE_DEVICE_TYPE(NES_CITYFIGHT, nes_cityfight_device) -DECLARE_DEVICE_TYPE(NES_SHUIGUAN, nes_shuiguan_device) -DECLARE_DEVICE_TYPE(NES_TF1201, nes_tf1201_device) -DECLARE_DEVICE_TYPE(NES_TH21311, nes_th21311_device) +DECLARE_DEVICE_TYPE(NES_2YUDB, nes_2yudb_device) +DECLARE_DEVICE_TYPE(NES_900218, nes_900218_device) +DECLARE_DEVICE_TYPE(NES_AX40G, nes_ax40g_device) +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_TF1201, nes_tf1201_device) +DECLARE_DEVICE_TYPE(NES_TH21311, nes_th21311_device) #endif // MAME_BUS_NES_VRC_CLONES_H