From 9bcd5a2b95c9164199f5d890630113d6bb1fb6c2 Mon Sep 17 00:00:00 2001 From: 0kmg <9137159+0kmg@users.noreply.github.com> Date: Tue, 12 Oct 2021 10:54:48 -0800 Subject: bus/nes: More VRC clone improvements: (#8690) * Added emulation for 900218 board (Lord of King pirate). * Re-implemented non-working City Fighter IV board. 4-bit PCM audio is still unemulated. * Simplified board with AX5705 VRC4 clone chip (SMB Pocker Mali). Software list items promoted to working (nes.xml) --------------------------------------- City Fighter IV (Asia) The Lord of King (Asia, pirate) --- hash/nes.xml | 6 +- src/devices/bus/nes/bootleg.cpp | 101 ---------------------- src/devices/bus/nes/bootleg.h | 24 ------ src/devices/bus/nes/nes_carts.cpp | 1 + src/devices/bus/nes/nes_ines.hxx | 2 +- src/devices/bus/nes/nes_pcb.hxx | 2 +- src/devices/bus/nes/nes_slot.h | 2 +- src/devices/bus/nes/pirate.cpp | 147 -------------------------------- src/devices/bus/nes/pirate.h | 33 -------- src/devices/bus/nes/vrc_clones.cpp | 169 ++++++++++++++++++++++++++++++++++++- src/devices/bus/nes/vrc_clones.h | 56 +++++++++++- 11 files changed, 228 insertions(+), 315 deletions(-) diff --git a/hash/nes.xml b/hash/nes.xml index 21e8fb01a12..927abbd5707 100644 --- a/hash/nes.xml +++ b/hash/nes.xml @@ -74259,8 +74259,8 @@ Other - - The Lord of King (Asia, Pirate) + + The Lord of King (Asia, pirate) 19?? <pirate> @@ -76709,7 +76709,7 @@ be better to redump them properly. --> - + City Fighter IV (Asia) 19?? <unknown> diff --git a/src/devices/bus/nes/bootleg.cpp b/src/devices/bus/nes/bootleg.cpp index a5262503ebd..a2a32d72579 100644 --- a/src/devices/bus/nes/bootleg.cpp +++ b/src/devices/bus/nes/bootleg.cpp @@ -40,7 +40,6 @@ // constructor //------------------------------------------------- -DEFINE_DEVICE_TYPE(NES_AX5705, nes_ax5705_device, "nes_ax5705", "NES Cart AX5705 PCB") DEFINE_DEVICE_TYPE(NES_SC127, nes_sc127_device, "nes_sc127", "NES Cart SC-127 PCB") DEFINE_DEVICE_TYPE(NES_MARIOBABY, nes_mbaby_device, "nes_mbaby", "NES Cart Mario Baby Bootleg PCB") DEFINE_DEVICE_TYPE(NES_ASN, nes_asn_device, "nes_asn", "NES Cart Ai Senshi Nicol Bootleg PCB") @@ -74,11 +73,6 @@ DEFINE_DEVICE_TYPE(NES_RT01, nes_rt01_device, "nes_rt01", "N DEFINE_DEVICE_TYPE(NES_YUNG08, nes_yung08_device, "nes_yung08", "NES Cart Super Mario Bros. 2 YUNG-08 PCB") -nes_ax5705_device::nes_ax5705_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : nes_nrom_device(mconfig, NES_AX5705, tag, owner, clock) -{ -} - nes_sc127_device::nes_sc127_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : nes_nrom_device(mconfig, NES_SC127, tag, owner, clock), m_irq_count(0), m_irq_enable(0) { @@ -247,28 +241,6 @@ nes_yung08_device::nes_yung08_device(const machine_config &mconfig, const char * -void nes_ax5705_device::device_start() -{ - common_start(); - save_item(NAME(m_mmc_prg_bank)); - save_item(NAME(m_mmc_vrom_bank)); -} - -void nes_ax5705_device::pcb_reset() -{ - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; - chr8(0, m_chr_source); - - m_mmc_prg_bank[0] = 0; - m_mmc_prg_bank[1] = 1; - prg8_89(m_mmc_prg_bank[0]); - prg8_ab(m_mmc_prg_bank[1]); - prg8_cd(0xfe); - prg8_ef(0xff); - - memset(m_mmc_vrom_bank, 0, sizeof(m_mmc_vrom_bank)); -} - void nes_sc127_device::device_start() { common_start(); @@ -740,79 +712,6 @@ void nes_yung08_device::pcb_reset() mapper specific handlers -------------------------------------------------*/ -/*------------------------------------------------- - - Board UNL-AX5705 - - Games: Super Mario Bros. Pocker Mali (Crayon Shin-chan pirate hack) - - NES 2.0: mapper 530 - - In MAME: Supported. - - -------------------------------------------------*/ - -void nes_ax5705_device::set_prg() -{ - prg8_89(m_mmc_prg_bank[0]); - prg8_ab(m_mmc_prg_bank[1]); -} - -void nes_ax5705_device::write_h(offs_t offset, uint8_t data) -{ - uint8_t bank; - LOG_MMC(("ax5705 write_h, offset: %04x, data: %02x\n", offset, data)); - - switch (offset & 0x700f) - { - case 0x0000: - m_mmc_prg_bank[0] = (data & 0x05) | ((data & 0x08) >> 2) | ((data & 0x02) << 2); - set_prg(); - break; - case 0x0008: - set_nt_mirroring(BIT(data, 0) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); - break; - case 0x2000: - m_mmc_prg_bank[1] = (data & 0x05) | ((data & 0x08) >> 2) | ((data & 0x02) << 2); - set_prg(); - break; - /* CHR banks 0, 1, 4, 5 */ - case 0x2008: - case 0x200a: - case 0x4008: - case 0x400a: - bank = ((offset & 0x4000) ? 4 : 0) + ((offset & 0x0002) ? 1 : 0); - m_mmc_vrom_bank[bank] = (m_mmc_vrom_bank[bank] & 0xf0) | (data & 0x0f); - chr1_x(bank, m_mmc_vrom_bank[bank], CHRROM); - break; - case 0x2009: - case 0x200b: - case 0x4009: - case 0x400b: - bank = ((offset & 0x4000) ? 4 : 0) + ((offset & 0x0002) ? 1 : 0); - m_mmc_vrom_bank[bank] = (m_mmc_vrom_bank[bank] & 0x0f) | ((data & 0x04) << 3) | ((data & 0x02) << 5) | ((data & 0x09) << 4); - chr1_x(bank, m_mmc_vrom_bank[bank], CHRROM); - break; - /* CHR banks 2, 3, 6, 7 */ - case 0x4000: - case 0x4002: - case 0x6000: - case 0x6002: - bank = 2 + ((offset & 0x2000) ? 4 : 0) + ((offset & 0x0002) ? 1 : 0); - m_mmc_vrom_bank[bank] = (m_mmc_vrom_bank[bank] & 0xf0) | (data & 0x0f); - chr1_x(bank, m_mmc_vrom_bank[bank], CHRROM); - break; - case 0x4001: - case 0x4003: - case 0x6001: - case 0x6003: - bank = 2 + ((offset & 0x2000) ? 4 : 0) + ((offset & 0x0002) ? 1 : 0); - m_mmc_vrom_bank[bank] = (m_mmc_vrom_bank[bank] & 0x0f) | ((data & 0x04) << 3) | ((data & 0x02) << 5) | ((data & 0x09) << 4); - chr1_x(bank, m_mmc_vrom_bank[bank], CHRROM); - break; - } -} - /*------------------------------------------------- SC-127 Board diff --git a/src/devices/bus/nes/bootleg.h b/src/devices/bus/nes/bootleg.h index f26ad81af4d..8367ba8fe1d 100644 --- a/src/devices/bus/nes/bootleg.h +++ b/src/devices/bus/nes/bootleg.h @@ -6,29 +6,6 @@ #include "nxrom.h" -// ======================> nes_ax5705_device - -class nes_ax5705_device : public nes_nrom_device -{ -public: - // construction/destruction - nes_ax5705_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 set_prg(); - uint8_t m_mmc_prg_bank[2]; - uint8_t m_mmc_vrom_bank[8]; -}; - - // ======================> nes_sc127_device class nes_sc127_device : public nes_nrom_device @@ -736,7 +713,6 @@ private: // device type definition -DECLARE_DEVICE_TYPE(NES_AX5705, nes_ax5705_device) DECLARE_DEVICE_TYPE(NES_SC127, nes_sc127_device) DECLARE_DEVICE_TYPE(NES_MARIOBABY, nes_mbaby_device) DECLARE_DEVICE_TYPE(NES_ASN, nes_asn_device) diff --git a/src/devices/bus/nes/nes_carts.cpp b/src/devices/bus/nes/nes_carts.cpp index cff3176786a..c11cedcc338 100644 --- a/src/devices/bus/nes/nes_carts.cpp +++ b/src/devices/bus/nes/nes_carts.cpp @@ -313,6 +313,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_900218", NES_900218); device.option_add_internal("09034a", NES_09034A); device.option_add_internal("l001", NES_L001); device.option_add_internal("batmanfs", NES_BATMANFS); diff --git a/src/devices/bus/nes/nes_ines.hxx b/src/devices/bus/nes/nes_ines.hxx index 506f4e25553..31e4e58c304 100644 --- a/src/devices/bus/nes/nes_ines.hxx +++ b/src/devices/bus/nes/nes_ines.hxx @@ -487,7 +487,7 @@ static const nes_mmc mmc_list[] = { 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 - // { 524, BTL_900218 }, this seems to be lordkinga + { 524, BTL_900218 }, // Lord of King pirate { 525, KAISER_KS7021A }, // GetsuFumaDen pirate (and maybe a Contra?) // 526 sangochu clone not yet in nes.xml? // 527 demnswrd/fudomyod 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 f79a8e09512..a3fe7f9140d 100644 --- a/src/devices/bus/nes/nes_pcb.hxx +++ b/src/devices/bus/nes/nes_pcb.hxx @@ -216,6 +216,7 @@ static const nes_pcb pcb_list[] = { "smb2jb", BTL_SMB2JB }, { "yung08", BTL_YUNG08 }, { "btl_0353", BTL_0353 }, + { "btl_900218", BTL_900218 }, // pirate The Lord of King { "09034a", BTL_09034A }, { "l001", BTL_L001 }, { "batmanfs", BTL_BATMANFS }, @@ -386,7 +387,6 @@ static const nes_pcb pcb_list[] = { "bmc_hik_kof", UNSUPPORTED_BOARD }, { "onebus", UNSUPPORTED_BOARD }, { "coolboy", UNSUPPORTED_BOARD }, - { "btl_900218", UNSUPPORTED_BOARD }, // pirate The Lord of King, to be emulated soon { "pec586", UNSUPPORTED_BOARD }, { "unl_drgnfgt", UNSUPPORTED_BOARD }, // Dragon Fighter by Flying Star { "test", TEST_BOARD }, diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h index 98a48335128..27a7a337169 100644 --- a/src/devices/bus/nes/nes_slot.h +++ b/src/devices/bus/nes/nes_slot.h @@ -117,7 +117,7 @@ enum UNL_MALISB, UNL_AC08, UNL_A9746, UNL_43272, UNL_TF1201, UNL_CITYFIGHT, UNL_NINJARYU, UNL_EH8813A, UNL_RT01, // Bootleg boards - BTL_0353, BTL_09034A, BTL_AISENSHINICOL, BTL_BATMANFS, + BTL_0353, BTL_09034A, 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, diff --git a/src/devices/bus/nes/pirate.cpp b/src/devices/bus/nes/pirate.cpp index 69cf7b08ad1..7b4bc04fef3 100644 --- a/src/devices/bus/nes/pirate.cpp +++ b/src/devices/bus/nes/pirate.cpp @@ -46,7 +46,6 @@ DEFINE_DEVICE_TYPE(NES_EDU2K, nes_edu2k_device, "nes_edu2k", " 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_CITYFIGHT, nes_cityfight_device, "nes_cityfight", "NES Cart City Fighter PCB") DEFINE_DEVICE_TYPE(NES_EH8813A, nes_eh8813a_device, "nes_eh8813a", "NES Cart UNL-EH8813A PCB") @@ -110,11 +109,6 @@ nes_43272_device::nes_43272_device(const machine_config &mconfig, const char *ta { } -nes_cityfight_device::nes_cityfight_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : nes_nrom_device(mconfig, NES_CITYFIGHT, tag, owner, clock), m_prg_reg(0), m_prg_mode(0), m_irq_count(0), m_irq_enable(0), irq_timer(nullptr) -{ -} - nes_eh8813a_device::nes_eh8813a_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : nes_nrom_device(mconfig, NES_EH8813A, tag, owner, clock), m_jumper(0), m_latch(0), m_reg(0) { @@ -306,33 +300,6 @@ void nes_43272_device::pcb_reset() m_latch = 0x81; } -void nes_cityfight_device::device_start() -{ - common_start(); - irq_timer = timer_alloc(TIMER_IRQ); - irq_timer->adjust(attotime::zero, 0, clocks_to_attotime(1)); - - save_item(NAME(m_prg_reg)); - save_item(NAME(m_prg_mode)); - save_item(NAME(m_irq_enable)); - save_item(NAME(m_irq_count)); - save_item(NAME(m_mmc_vrom_bank)); -} - -void nes_cityfight_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); - - memset(m_mmc_vrom_bank, 0, sizeof(m_mmc_vrom_bank)); - m_prg_reg = 0; - m_prg_mode = 0; - m_irq_enable = 0; - m_irq_count = 0; -} - void nes_eh8813a_device::device_start() { common_start(); @@ -878,120 +845,6 @@ uint8_t nes_43272_device::read_h(offs_t offset) return hi_access_rom(offset & mask); } -/*------------------------------------------------- - - UNL-CITYFIGHT - - Games: - - Additional audio register not emulated yet! - - In MESS: Preliminary Supported - - -------------------------------------------------*/ - -void nes_cityfight_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - if (id == TIMER_IRQ) - { - if (m_irq_enable) - { - if (!m_irq_count) - { - hold_irq_line(); - m_irq_count = 0xffff; - } - else - m_irq_count--; - } - } -} - -void nes_cityfight_device::update_prg() -{ - prg32(m_prg_reg >> 2); - if (!m_prg_mode) - prg8_cd(m_prg_reg); -} - -void nes_cityfight_device::write_h(offs_t offset, uint8_t data) -{ - int bank; - LOG_MMC(("unl_cityfight write_h, offset: %04x, data: %02x\n", offset, data)); - - switch (offset & 0x700c) - { - case 0x1000: - 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; - } - m_prg_reg = data & 0xc; - break; - case 0x1004: - case 0x1008: - case 0x100c: - if (offset & 0x800) - LOG_MMC(("Extended Audio write, data %x!", data & 0x0f));//pcmwrite(0x4011, (V & 0xf) << 3); - else - m_prg_reg = data & 0xc; - break; - - - case 0x2000: case 0x2004: case 0x2008: case 0x200c: - bank = 2 + BIT(offset, 3); - if (offset & 4) - m_mmc_vrom_bank[bank] = (m_mmc_vrom_bank[bank] & 0x0f) | ((data & 0x0f) << 4); - else - m_mmc_vrom_bank[bank] = (m_mmc_vrom_bank[bank] & 0xf0) | ((data & 0x0f) << 0); - chr1_x(bank, m_mmc_vrom_bank[bank], m_chr_source); - break; - case 0x3000: case 0x3004: case 0x3008: case 0x300c: - bank = 4 + BIT(offset, 3); - if (offset & 4) - m_mmc_vrom_bank[bank] = (m_mmc_vrom_bank[bank] & 0x0f) | ((data & 0x0f) << 4); - else - m_mmc_vrom_bank[bank] = (m_mmc_vrom_bank[bank] & 0xf0) | ((data & 0x0f) << 0); - chr1_x(bank, m_mmc_vrom_bank[bank], m_chr_source); - break; - case 0x5000: case 0x5004: case 0x5008: case 0x500c: - bank = 0 + BIT(offset, 3); - if (offset & 4) - m_mmc_vrom_bank[bank] = (m_mmc_vrom_bank[bank] & 0x0f) | ((data & 0x0f) << 4); - else - m_mmc_vrom_bank[bank] = (m_mmc_vrom_bank[bank] & 0xf0) | ((data & 0x0f) << 0); - chr1_x(bank, m_mmc_vrom_bank[bank], m_chr_source); - break; - case 0x6000: case 0x6004: case 0x6008: case 0x600c: - bank = 6 + BIT(offset, 3); - if (offset & 4) - m_mmc_vrom_bank[bank] = (m_mmc_vrom_bank[bank] & 0x0f) | ((data & 0x0f) << 4); - else - m_mmc_vrom_bank[bank] = (m_mmc_vrom_bank[bank] & 0xf0) | ((data & 0x0f) << 0); - chr1_x(bank, m_mmc_vrom_bank[bank], m_chr_source); - break; - - case 0x4000: - case 0x4004: - case 0x4008: - case 0x400c: - m_prg_mode = data & 1; - [[fallthrough]]; - case 0x7000: - m_irq_count = (m_irq_count & 0x1e0) | ((data & 0x0f) << 1); - break; - case 0x7004: - m_irq_count = (m_irq_count & 0x1e) | ((data & 0x0f) << 5); - break; - case 0x7008: - m_irq_enable = BIT(data, 1); - break; - } -} - /*------------------------------------------------- UNL-EH8813A diff --git a/src/devices/bus/nes/pirate.h b/src/devices/bus/nes/pirate.h index 1b0766f9d92..87c1a96dc1c 100644 --- a/src/devices/bus/nes/pirate.h +++ b/src/devices/bus/nes/pirate.h @@ -257,38 +257,6 @@ private: }; -// ======================> nes_cityfight_device - -class nes_cityfight_device : public nes_nrom_device -{ -public: - // construction/destruction - nes_cityfight_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; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - -private: - static constexpr device_timer_id TIMER_IRQ = 0; - - void update_prg(); - - uint8_t m_prg_reg, m_prg_mode; - uint16_t m_irq_count; - int m_irq_enable; - - emu_timer *irq_timer; - - uint8_t m_mmc_vrom_bank[8]; -}; - - // ======================> nes_eh8813a_device class nes_eh8813a_device : public nes_nrom_device @@ -351,7 +319,6 @@ 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_CITYFIGHT, nes_cityfight_device) DECLARE_DEVICE_TYPE(NES_EH8813A, nes_eh8813a_device) //DECLARE_DEVICE_TYPE(NES_FUJIYA, nes_fujiya_device) diff --git a/src/devices/bus/nes/vrc_clones.cpp b/src/devices/bus/nes/vrc_clones.cpp index e961b20ffb9..5d6c06f9238 100644 --- a/src/devices/bus/nes/vrc_clones.cpp +++ b/src/devices/bus/nes/vrc_clones.cpp @@ -28,10 +28,28 @@ // constructor //------------------------------------------------- -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_900218, nes_900218_device, "nes_900218", "NES Cart 900218 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") +nes_900218_device::nes_900218_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_konami_vrc4_device(mconfig, NES_900218, tag, owner, clock) +{ +} + +nes_ax5705_device::nes_ax5705_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_konami_vrc4_device(mconfig, NES_AX5705, tag, owner, clock) +{ +} + +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) +{ +} + nes_shuiguan_device::nes_shuiguan_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : nes_konami_vrc4_device(mconfig, NES_SHUIGUAN, tag, owner, clock) { @@ -44,6 +62,33 @@ nes_tf1201_device::nes_tf1201_device(const machine_config &mconfig, const char * +void nes_900218_device::device_start() +{ + nes_konami_vrc4_device::device_start(); + + // VRC4 pins 3 and 4 + m_vrc_ls_prg_a = 1; // A1 + m_vrc_ls_prg_b = 0; // A0 +} + +void nes_ax5705_device::device_start() +{ + nes_konami_vrc4_device::device_start(); + + // VRC4 pins 3 and 4 + m_vrc_ls_prg_a = 1; // A1 + m_vrc_ls_prg_b = 0; // A0 +} + +void nes_cityfight_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_shuiguan_device::device_start() { nes_konami_vrc4_device::device_start(); @@ -75,6 +120,126 @@ void nes_tf1201_device::device_start() mapper specific handlers -------------------------------------------------*/ +/*------------------------------------------------- + + Board BTL-900218 + + Games: Lord of King (Astyanax pirate) + + This board has a VRC2 clone that has been altered to + add a simple IRQ counter fixed to 1024 CPU cycles. + + NES 2.0: mapper 524 + + In MAME: Supported. + + -------------------------------------------------*/ + +void nes_900218_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + if (id == TIMER_IRQ) + { + if (m_irq_enable) + { + m_irq_count++; + set_irq_line(BIT(m_irq_count, 10) ? ASSERT_LINE : CLEAR_LINE); + } + } +} + +void nes_900218_device::write_h(offs_t offset, u8 data) +{ + LOG_MMC(("900218 write_h, offset: %04x, data: %02x\n", offset, data)); + + if ((offset & 0x7000) == 0x7000) + { + switch (offset & 0xc) + { + case 0x8: + m_irq_enable = 1; + break; + case 0xc: + m_irq_enable = 0; + m_irq_count = 0; + set_irq_line(CLEAR_LINE); + break; + } + } + else + nes_konami_vrc4_device::write_h(offset, data); +} + +/*------------------------------------------------- + + Board UNL-AX5705 + + Games: Super Mario Bros. Pocker Mali (Crayon Shin-chan pirate hack) + + VRC4 clone with a few PRG/CHR address lines swapped. + + NES 2.0: mapper 530 + + In MAME: Supported. + + -------------------------------------------------*/ + +void nes_ax5705_device::write_h(offs_t offset, u8 data) +{ + LOG_MMC(("ax5705 write_h, offset: %04x, data: %02x\n", offset, data)); + + offset = (offset & ~0x1000) | BIT(offset, 3) << 12; + switch (offset & 0x7001) + { + case 0x0000: case 0x0001: case 0x2000: case 0x2001: + data = bitswap<4>(data, 1, 2, 3, 0); + break; + case 0x3001: case 0x4001: case 0x5001: case 0x6001: + data = bitswap<3>(data, 1, 2, 0); + break; + } + nes_konami_vrc4_device::write_h(offset, data); +} + +/*------------------------------------------------- + + UNL-CITYFIGHT + + Games: City Fighter IV + + VRC4 clone with simple 32K PRG banking (it's a minimal + hack of Master Fighter II banking). More interestingly + it adds a 4-bit PCM audio register, not emulated yet. + + NES 2.0: mapper 266 + + In MAME: Partially supported. + + -------------------------------------------------*/ + +void nes_cityfight_device::write_h(offs_t offset, u8 data) +{ + LOG_MMC(("unl_cityfight write_h, offset: %04x, data: %02x\n", offset, data)); + + offset = (offset & ~0x6000) | bitswap<2>(offset, 13, 14) << 13; + switch (offset & 0x7800) + { + case 0x0000: + case 0x0800: + break; // PRG banking at $8000 ignored + case 0x1000: + prg32((data >> 2) & 0x03); + if (!(offset & 3)) // $9000 is also VRC4 mirroring + nes_konami_vrc4_device::write_h(offset, data); + break; + case 0x1800: + LOG_MMC(("Extended Audio write, data %x!", data & 0x0f)); // pcmwrite(0x4011, (V & 0xf) << 3); (etabeta's original comment, FCEUX code) + break; + default: + nes_konami_vrc4_device::write_h(offset, data); + break; + } +} + /*------------------------------------------------- BTL-SHUIGUANPIPE diff --git a/src/devices/bus/nes/vrc_clones.h b/src/devices/bus/nes/vrc_clones.h index 6fb950c1c7e..8ad84e629ca 100644 --- a/src/devices/bus/nes/vrc_clones.h +++ b/src/devices/bus/nes/vrc_clones.h @@ -8,6 +8,55 @@ #include "konami.h" +// ======================> nes_900218_device + +class nes_900218_device : public nes_konami_vrc4_device +{ +public: + // construction/destruction + nes_900218_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 device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; +}; + + +// ======================> nes_ax5705_device + +class nes_ax5705_device : public nes_konami_vrc4_device +{ +public: + // construction/destruction + nes_ax5705_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_cityfight_device + +class nes_cityfight_device : public nes_konami_vrc4_device +{ +public: + // construction/destruction + nes_cityfight_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual void write_h(offs_t offset, uint8_t data) override; + +protected: + // device-level overrides + virtual void device_start() override; +}; + + // ======================> nes_shuiguan_device class nes_shuiguan_device : public nes_konami_vrc4_device @@ -48,7 +97,10 @@ protected: // device type definition -DECLARE_DEVICE_TYPE(NES_SHUIGUAN, nes_shuiguan_device) -DECLARE_DEVICE_TYPE(NES_TF1201, nes_tf1201_device) +DECLARE_DEVICE_TYPE(NES_900218, nes_900218_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) #endif // MAME_BUS_NES_VRC_CLONES_H -- cgit v1.2.3