diff --git a/hash/nes.xml b/hash/nes.xml index 199bd598648..c3dc3abf0ec 100644 --- a/hash/nes.xml +++ b/hash/nes.xml @@ -21110,11 +21110,12 @@ license:CC0 - Kung Fu (Jpn, USA) + Kung Fu (Japan, USA) 1985 Nintendo + - + @@ -34585,7 +34586,7 @@ license:CC0 - Sky Kid (Jpn) + SkyKid (Japan) 1986 Namcot @@ -34605,7 +34606,7 @@ license:CC0 - Sky Kid (USA) + SkyKid (USA) 1987 Sunsoft @@ -49099,6 +49100,29 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx + + + Nintendo Campus Challenge 1991 (bootleg) + 2009 + RetroZone + + + + + + + + + + + + + + + + + + Nintendo World Cup (Euro, Rev. B) 1990 diff --git a/src/devices/bus/nes/event.cpp b/src/devices/bus/nes/event.cpp index 182a4e76a86..f3db7a615ff 100644 --- a/src/devices/bus/nes/event.cpp +++ b/src/devices/bus/nes/event.cpp @@ -1,14 +1,15 @@ // license:BSD-3-Clause -// copyright-holders:Fabio Priuli +// copyright-holders:Fabio Priuli,kmg /*********************************************************************************************************** - NES/Famicom cartridge emulation for Nintendo NES-EVENT PCB + NES/Famicom cartridge emulation for Nintendo NES-EVENT PCBs Here we emulate the following PCBs * Nintendo NES-EVENT [mapper 105] + * Nintendo NES-EVENT2 [mapper 555] ***********************************************************************************************************/ @@ -30,7 +31,8 @@ // constructor //------------------------------------------------- -DEFINE_DEVICE_TYPE(NES_EVENT, nes_event_device, "nes_event", "NES Cart Event PCB") +DEFINE_DEVICE_TYPE(NES_EVENT, nes_event_device, "nes_event", "NES Cart EVENT PCB") +DEFINE_DEVICE_TYPE(NES_EVENT2, nes_event2_device, "nes_event2", "NES Cart EVENT2 PCB") nes_event_device::nes_event_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) @@ -44,6 +46,16 @@ nes_event_device::nes_event_device(const machine_config &mconfig, const char *ta { } +nes_event2_device::nes_event2_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_tqrom_device(mconfig, NES_EVENT2, tag, owner, clock) + , m_dsw(*this, "DIPSW") + , m_tqrom_mode(false) + , event_timer(nullptr) + , m_timer_count(0) + , m_timer_enabled(0) +{ +} + void nes_event_device::device_start() { @@ -71,6 +83,30 @@ void nes_event_device::pcb_reset() m_timer_on = 0; } +void nes_event2_device::device_start() +{ + mmc3_start(); + + event_timer = timer_alloc(TIMER_EVENT); + event_timer->adjust(attotime::zero, 0, clocks_to_attotime(1)); + + save_item(NAME(m_tqrom_mode)); + + save_item(NAME(m_timer_count)); + save_item(NAME(m_timer_enabled)); +} + +void nes_event2_device::pcb_reset() +{ + m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; + + m_tqrom_mode = false; + mmc3_common_initialize(0x07, 0x7f, 0); + + m_timer_count = 0; + m_timer_enabled = 0; +} + /*------------------------------------------------- @@ -79,9 +115,9 @@ void nes_event_device::pcb_reset() /*------------------------------------------------- - Event PCB + EVENT PCB - Games: Nintento World Championships + Games: Nintento World Championships 1990 MMC1 variant with repurposed register at $a000 and a lot of discrete components @@ -135,6 +171,93 @@ void nes_event_device::set_prg() } } +/*------------------------------------------------- + + EVENT2 PCB + + Games: Nintento Campus Challenge 1991 + + Similar to the previous EVENT PCB, but based around + the MMC3. Onboard 8K VRAM and 8K WRAM support Pinbot + and SMB3, respectively, and an additional 2K WRAM at + $5000 is used by the control routine. The board also + featured an RJ11, used to transmit player names and + scores to a display at the staged events. + + The present emulation is based on what is known via + the reproduction board by RetroZone. That board is + missing the RJ11, two DIP switches, and...? + + NES 2.0: mapper 555 + + In MAME: Supported. + + -------------------------------------------------*/ + +u8 nes_event2_device::read_l(offs_t offset) +{ +// LOG_MMC(("event2 read_l, offset: %04x\n", offset)); + offset += 0x100; + if (offset >= 0x1800) + return (m_timer_count >= (0x10 | m_dsw->read()) << 25) ? 0x80 : 0; + else if (offset < 0x1000 || m_prgram.empty()) + return get_open_bus(); + else + return m_prgram[(0x2000 + (offset & 0x7ff)) % m_prgram.size()]; +} + +u8 nes_event2_device::read_m(offs_t offset) +{ +// LOG_MMC(("event2 read_m, offset: %04x\n", offset)); + if (m_prgram.empty()) + return get_open_bus(); + else + return m_prgram[offset % m_prgram.size()]; +} + +void nes_event2_device::write_l(offs_t offset, u8 data) +{ + LOG_MMC(("event2 write_l, offset: %04x, data: %02x\n", offset, data)); + + offset += 0x100; + switch (offset & 0x1c00) + { + case 0x1000: + case 0x1400: + m_prgram[(0x2000 + (offset & 0x7ff)) % m_prgram.size()] = data; + break; + case 0x1800: + m_tqrom_mode = (data & 0x06) == 0x02; + + m_prg_base = (data & 0x04) << 3; + m_prg_mask = (data & 0x03) << 3 | 0x07; + set_prg(m_prg_base, m_prg_mask); + + m_chr_base = m_prg_base << 2; + set_chr(m_chr_source, m_chr_base, m_chr_mask); + + m_timer_enabled = BIT(data, 3); + if (!m_timer_enabled) + m_timer_count = 0; + break; + } +} + +void nes_event2_device::write_m(offs_t offset, u8 data) +{ +// LOG_MMC(("event2 write_m, offset: %04x, data: %02x\n", offset, data)); + if (!m_prgram.empty()) + m_prgram[offset % m_prgram.size()] = data; +} + +void nes_event2_device::set_chr(u8 chr, int chr_base, int chr_mask) +{ + if (m_tqrom_mode) + nes_tqrom_device::set_chr(chr, chr_base, chr_mask); + else + nes_txrom_device::set_chr(chr, chr_base, chr_mask); +} + //------------------------------------------------- // Dipswitch @@ -168,6 +291,11 @@ ioport_constructor nes_event_device::device_input_ports() const return INPUT_PORTS_NAME( nwc_dsw ); } +ioport_constructor nes_event2_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( nwc_dsw ); +} + //------------------------------------------------- // device_timer - handler timer events @@ -184,3 +312,9 @@ void nes_event_device::device_timer(emu_timer &timer, device_timer_id id, int pa } } } + +void nes_event2_device::device_timer(emu_timer &timer, device_timer_id id, int param) +{ + if (id == TIMER_EVENT && m_timer_enabled) + m_timer_count++; +} diff --git a/src/devices/bus/nes/event.h b/src/devices/bus/nes/event.h index 5fdd6b88303..75f4e026c8b 100644 --- a/src/devices/bus/nes/event.h +++ b/src/devices/bus/nes/event.h @@ -1,11 +1,12 @@ // license:BSD-3-Clause -// copyright-holders:Fabio Priuli +// copyright-holders:Fabio Priuli,kmg #ifndef MAME_BUS_NES_EVENT_H #define MAME_BUS_NES_EVENT_H #pragma once #include "mmc1.h" +#include "mmc3.h" // ======================> nes_event_device @@ -38,8 +39,43 @@ protected: int m_timer_on, m_timer_enabled; }; +// ======================> nes_event2_device + +class nes_event2_device : public nes_tqrom_device +{ +public: + // construction/destruction + nes_event2_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual u8 read_l(offs_t offset) override; + virtual void write_l(offs_t offset, u8 data) override; + 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 device_timer(emu_timer &timer, device_timer_id id, int param) override; + virtual ioport_constructor device_input_ports() const override; + + virtual void set_chr(u8 chr, int chr_base, int chr_mask) override; + + required_ioport m_dsw; + + bool m_tqrom_mode; + + static constexpr device_timer_id TIMER_EVENT = 0; + emu_timer *event_timer; + + u32 m_timer_count; + int m_timer_enabled; +}; + // device type definition -DECLARE_DEVICE_TYPE(NES_EVENT, nes_event_device) +DECLARE_DEVICE_TYPE(NES_EVENT, nes_event_device) +DECLARE_DEVICE_TYPE(NES_EVENT2, nes_event2_device) #endif // MAME_BUS_NES_EVENT_H diff --git a/src/devices/bus/nes/mmc3.cpp b/src/devices/bus/nes/mmc3.cpp index 3ecbc024a96..ded4c21db0e 100644 --- a/src/devices/bus/nes/mmc3.cpp +++ b/src/devices/bus/nes/mmc3.cpp @@ -79,8 +79,13 @@ nes_txsrom_device::nes_txsrom_device(const machine_config &mconfig, const char * { } -nes_tqrom_device::nes_tqrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : nes_txrom_device(mconfig, NES_TQROM, tag, owner, clock) +nes_tqrom_device::nes_tqrom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) + : nes_txrom_device(mconfig, type, tag, owner, clock) +{ +} + +nes_tqrom_device::nes_tqrom_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : nes_tqrom_device(mconfig, NES_TQROM, tag, owner, clock) { } diff --git a/src/devices/bus/nes/mmc3.h b/src/devices/bus/nes/mmc3.h index c0c60d52375..244863d6fe7 100644 --- a/src/devices/bus/nes/mmc3.h +++ b/src/devices/bus/nes/mmc3.h @@ -87,10 +87,9 @@ class nes_txsrom_device : public nes_txrom_device { public: // construction/destruction - nes_txsrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + nes_txsrom_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - // device-level overrides - virtual void write_h(offs_t offset, uint8_t data) override; + virtual void write_h(offs_t offset, u8 data) override; virtual void chr_cb(int start, int bank, int source) override; protected: @@ -107,10 +106,13 @@ class nes_tqrom_device : public nes_txrom_device { public: // construction/destruction - nes_tqrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + nes_tqrom_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: - virtual void set_chr( uint8_t chr, int chr_base, int chr_mask ) override; + // construction/destruction + nes_tqrom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); + + virtual void set_chr(u8 chr, int chr_base, int chr_mask) override; }; @@ -122,7 +124,6 @@ public: // construction/destruction nes_qj_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - // device-level overrides virtual void write_m(offs_t offset, uint8_t data) override; virtual void pcb_reset() override; }; @@ -136,7 +137,6 @@ public: // construction/destruction nes_zz_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - // device-level overrides virtual void write_m(offs_t offset, uint8_t data) override; virtual void pcb_reset() override; }; diff --git a/src/devices/bus/nes/nes_carts.cpp b/src/devices/bus/nes/nes_carts.cpp index 111c72f3591..35cac97f6fb 100644 --- a/src/devices/bus/nes/nes_carts.cpp +++ b/src/devices/bus/nes/nes_carts.cpp @@ -119,6 +119,7 @@ void nes_cart(device_slot_interface &device) device.option_add_internal("pal_zz", NES_ZZ_PCB); device.option_add_internal("nes_qj", NES_QJ_PCB); device.option_add_internal("nes_event", NES_EVENT); + device.option_add_internal("nes_event2", NES_EVENT2); // Discrete Components boards // IC_74x139x74 device.option_add_internal("discrete_74x139", NES_74X139X74); diff --git a/src/devices/bus/nes/nes_ines.hxx b/src/devices/bus/nes/nes_ines.hxx index ac7454bb347..4512d02dede 100644 --- a/src/devices/bus/nes/nes_ines.hxx +++ b/src/devices/bus/nes/nes_ines.hxx @@ -516,7 +516,7 @@ static const nes_mmc mmc_list[] = // 552 TAITO_X1_017, this is a correction of mapper 82. We should drop 82 and only support the accurate dumps of 552? { 553, SACHEN_3013 }, // Dong Dong Nao 1 { 554, KAISER_KS7010 }, // Akumajo Dracula FDS conversion - // 555 retroUSB re-release of 1991 Nintendo Campus Challenge + { 555, STD_EVENT2 }, // 556 JY-215 multicart { 557, UNL_LG25 }, // Moero TwinBee FDS conversion // 558 some games on YC-03-09 board (related to mappers 162-164) diff --git a/src/devices/bus/nes/nes_pcb.hxx b/src/devices/bus/nes/nes_pcb.hxx index 6d4673834d5..9a1dd1d99f6 100644 --- a/src/devices/bus/nes/nes_pcb.hxx +++ b/src/devices/bus/nes/nes_pcb.hxx @@ -42,6 +42,7 @@ static const nes_pcb pcb_list[] = { "pal_zz", PAL_ZZ }, { "nes_qj", NES_QJ }, { "nes_event", STD_EVENT }, + { "nes_event2", STD_EVENT2 }, { "discrete_74x139", DIS_74X139X74 }, { "discrete_74x377", DIS_74X377 }, { "discrete_74x161", DIS_74X161X161X32 }, diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h index 40f9a4164d9..e397d102fed 100644 --- a/src/devices/bus/nes/nes_slot.h +++ b/src/devices/bus/nes/nes_slot.h @@ -26,7 +26,7 @@ enum STD_SXROM, STD_SOROM, STD_SZROM, STD_TXROM, STD_TXSROM, STD_TKROM, STD_TQROM, STD_UXROM, STD_UN1ROM, UXROM_CC, - HVC_FAMBASIC, NES_QJ, PAL_ZZ, STD_EVENT, + HVC_FAMBASIC, NES_QJ, PAL_ZZ, STD_EVENT, STD_EVENT2, STD_DISKSYS, STD_NROM368,//homebrew extension of NROM! // Discrete components boards (by various manufacturer)