From ca090b8eec0e2d7778f42bee2443a3f5dbf7f868 Mon Sep 17 00:00:00 2001 From: Fabio Priuli Date: Mon, 17 Feb 2014 08:28:26 +0000 Subject: [PATCH] (MESS) nes: added Karaoke Studio inputs, mapped to keys Z, X, C. you can now select songs and see the animation, even if I would not call playable the games this way. [Fabio Priuli] out of whatsnew: the expansion slot is currently hacked around at loading time. I will soon implement it as a subslot, but I still need to check a few details first. --- .gitattributes | 2 + hash/nes.xml | 16 ++--- hash/nes_datach.xml | 11 +-- src/mess/includes/nes.h | 1 + src/mess/machine/nes_bandai.c | 46 ++----------- src/mess/machine/nes_bandai.h | 19 ------ src/mess/machine/nes_karastudio.c | 109 ++++++++++++++++++++++++++++++ src/mess/machine/nes_karastudio.h | 30 ++++++++ src/mess/mess.mak | 1 + 9 files changed, 161 insertions(+), 74 deletions(-) create mode 100644 src/mess/machine/nes_karastudio.c create mode 100644 src/mess/machine/nes_karastudio.h diff --git a/.gitattributes b/.gitattributes index f27aa3e102d..8775c72ee22 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8209,6 +8209,8 @@ src/mess/machine/nes_jy.c svneol=native#text/plain src/mess/machine/nes_jy.h svneol=native#text/plain src/mess/machine/nes_kaiser.c svneol=native#text/plain src/mess/machine/nes_kaiser.h svneol=native#text/plain +src/mess/machine/nes_karastudio.c svneol=native#text/plain +src/mess/machine/nes_karastudio.h svneol=native#text/plain src/mess/machine/nes_konami.c svneol=native#text/plain src/mess/machine/nes_konami.h svneol=native#text/plain src/mess/machine/nes_legacy.c svneol=native#text/plain diff --git a/hash/nes.xml b/hash/nes.xml index 62a341e34db..a0575c326b6 100644 --- a/hash/nes.xml +++ b/hash/nes.xml @@ -49856,15 +49856,14 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx - + + + - - - @@ -49879,15 +49878,14 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx - + + + - - - @@ -64356,7 +64354,7 @@ Also notice that VRAM & WRAM are probably incorrect for some of these sets, at t - + diff --git a/hash/nes_datach.xml b/hash/nes_datach.xml index 2697c7c023c..654ffee348f 100644 --- a/hash/nes_datach.xml +++ b/hash/nes_datach.xml @@ -11,9 +11,11 @@ - + + + - + @@ -75,9 +77,10 @@ - + + - + diff --git a/src/mess/includes/nes.h b/src/mess/includes/nes.h index 80353c6194c..d9a28dc6b0d 100644 --- a/src/mess/includes/nes.h +++ b/src/mess/includes/nes.h @@ -27,6 +27,7 @@ #include "machine/nes_event.h" #include "machine/nes_irem.h" #include "machine/nes_jaleco.h" +#include "machine/nes_karastudio.h" #include "machine/nes_konami.h" #include "machine/nes_namcot.h" #include "machine/nes_pt554.h" diff --git a/src/mess/machine/nes_bandai.c b/src/mess/machine/nes_bandai.c index 50e0bbc5ba4..b5420408e69 100644 --- a/src/mess/machine/nes_bandai.c +++ b/src/mess/machine/nes_bandai.c @@ -14,17 +14,18 @@ * Bandai LZ93D50 + 24C01 EEPROM [mapper 159] * Bandai LZ93D50 + 24C02 EEPROM [mapper 16] * Bandai Famicom Jump 2 (aka LZ93D50 + SRAM) [mapper 153] - * Bandai Karaoke Studio [mapper 188] * Bandai Oeka Kids [mapper 96] * Bandai Datach Joint ROM System [mapper 157] is emulated in a separate source file to implement also the subslot, but the PCB is basically a Bandai LZ93D50 + 24C02 EEPROM pcb with added barcode reader and subslot - + + * Bandai Karaoke Studio [mapper 188] is emulated in a separate source file + to implement also the subslot and the mic inputs + TODO: - investigate why EEPROM does not work - - try to implement some sort of Karaoke emulation - add support to the PPU for the code necessary to Oeka Kids games (also needed by UNL-DANCE2000 PCB) - check the cause for the flickering in Famicom Jump 2 @@ -50,7 +51,6 @@ // constructor //------------------------------------------------- -const device_type NES_KARAOKESTUDIO = &device_creator; const device_type NES_OEKAKIDS = &device_creator; const device_type NES_FCG = &device_creator; const device_type NES_LZ93D50 = &device_creator; @@ -59,11 +59,6 @@ const device_type NES_LZ93D50_24C02 = &device_creator; const device_type NES_FJUMP2 = &device_creator; -nes_karaokestudio_device::nes_karaokestudio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : nes_nrom_device(mconfig, NES_KARAOKESTUDIO, "NES Cart Bandai Karaoke Studio PCB", tag, owner, clock, "nes_karaoke", __FILE__) -{ -} - nes_oekakids_device::nes_oekakids_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : nes_nrom_device(mconfig, NES_OEKAKIDS, "NES Cart Bandai Oeka Kids PCB", tag, owner, clock, "nes_oeka", __FILE__) { @@ -113,20 +108,6 @@ nes_fjump2_device::nes_fjump2_device(const machine_config &mconfig, const char * - -void nes_karaokestudio_device::device_start() -{ - common_start(); -} - -void nes_karaokestudio_device::pcb_reset() -{ - m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; - prg16_89ab(0); - prg16_cdef((m_prg_chunks - 1) ^ 0x08); - chr8(0, m_chr_source); -} - void nes_oekakids_device::device_start() { common_start(); @@ -210,25 +191,6 @@ void nes_fjump2_device::pcb_reset() mapper specific handlers -------------------------------------------------*/ -/*------------------------------------------------- - - Bandai Karaoke Studio board emulation - - Games: Karaoke Studio - - Note: we currently do not emulate the mic - - iNES: mapper 188 - - -------------------------------------------------*/ - -WRITE8_MEMBER(nes_karaokestudio_device::write_h) -{ - LOG_MMC(("karaoke studio write_h, offset: %04x, data: %02x\n", offset, data)); - - prg16_89ab(data ^ 0x08); -} - /*------------------------------------------------- Bandai Oeka Kids board emulation diff --git a/src/mess/machine/nes_bandai.h b/src/mess/machine/nes_bandai.h index 804ffbf9ab0..eabcfff4ace 100644 --- a/src/mess/machine/nes_bandai.h +++ b/src/mess/machine/nes_bandai.h @@ -5,24 +5,6 @@ #include "machine/i2cmem.h" -// ======================> nes_karaokestudio_device - -class nes_karaokestudio_device : public nes_nrom_device -{ -public: - // construction/destruction - nes_karaokestudio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // device-level overrides - virtual void device_start(); - virtual DECLARE_WRITE8_MEMBER(write_h); - - virtual void pcb_reset(); - - // TODO: add microphone I/O emulation -}; - - // ======================> nes_oekakids_device class nes_oekakids_device : public nes_nrom_device @@ -147,7 +129,6 @@ protected: // device type definition -extern const device_type NES_KARAOKESTUDIO; extern const device_type NES_OEKAKIDS; extern const device_type NES_FCG; extern const device_type NES_LZ93D50; diff --git a/src/mess/machine/nes_karastudio.c b/src/mess/machine/nes_karastudio.c new file mode 100644 index 00000000000..46877416b77 --- /dev/null +++ b/src/mess/machine/nes_karastudio.c @@ -0,0 +1,109 @@ +/*********************************************************************************************************** + + + NES/Famicom cartridge emulation for Bandai Karaoke Studio + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + + + Here we emulate the following PCBs Bandai Karaoke Studio [mapper 188] + + + TODO: + - emulate the actual expansion slot for the Senyou Cassettes + + ***********************************************************************************************************/ + + +#include "emu.h" +#include "machine/nes_karastudio.h" + +#ifdef NES_PCB_DEBUG +#define VERBOSE 1 +#else +#define VERBOSE 0 +#endif + +#define LOG_MMC(x) do { if (VERBOSE) logerror x; } while (0) + + + +//------------------------------------------------- +// constructor +//------------------------------------------------- + +const device_type NES_KARAOKESTUDIO = &device_creator; + + +nes_karaokestudio_device::nes_karaokestudio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : nes_nrom_device(mconfig, NES_KARAOKESTUDIO, "NES Cart Bandai Karaoke Studio PCB", tag, owner, clock, "nes_karaoke", __FILE__), + m_mic_ipt(*this, "MIC") +{ +} + + +void nes_karaokestudio_device::device_start() +{ + common_start(); +} + +void nes_karaokestudio_device::pcb_reset() +{ + m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; + prg16_89ab(0); + prg16_cdef((m_prg_chunks - 1) ^ 0x08); + chr8(0, m_chr_source); +} + + +/*------------------------------------------------- + mapper specific handlers + -------------------------------------------------*/ + +/*------------------------------------------------- + + Bandai Karaoke Studio board emulation + + Games: Karaoke Studio + expansion carts with + additional songs + + Note: we currently do not emulate properly the + expansion slot + + iNES: mapper 188 + + -------------------------------------------------*/ + +READ8_MEMBER(nes_karaokestudio_device::read_m) +{ + LOG_MMC(("karaoke studio read_m, offset: %04x\n", offset)); + return m_mic_ipt->read(); +} + +WRITE8_MEMBER(nes_karaokestudio_device::write_h) +{ + LOG_MMC(("karaoke studio write_h, offset: %04x, data: %02x\n", offset, data)); + // bit3 1 = M ROM (main unit), 0=E ROM (expansion) + // HACK(?): currently it is not clear how the unit acknowledges the presence of the expansion + // cart (when expansion is present, code keeps switching both from the expansion rom and from + // the main ROM), so we load the expansion after the main PRG and handle banking as follows + data ^= 8; + + prg16_89ab(data); +} + + + +static INPUT_PORTS_START( karaoke_mic ) + PORT_START("MIC") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("A (Mic Select)") PORT_CODE(KEYCODE_X) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("B (Mic Start)") PORT_CODE(KEYCODE_Z) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Microphone (?)") PORT_CODE(KEYCODE_C) + PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +ioport_constructor nes_karaokestudio_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( karaoke_mic ); +} diff --git a/src/mess/machine/nes_karastudio.h b/src/mess/machine/nes_karastudio.h new file mode 100644 index 00000000000..b42642732f3 --- /dev/null +++ b/src/mess/machine/nes_karastudio.h @@ -0,0 +1,30 @@ +#ifndef __NES_KARASTUDIO_H +#define __NES_KARASTUDIO_H + +#include "machine/nes_nxrom.h" + + +// ======================> nes_karaokestudio_device + +class nes_karaokestudio_device : public nes_nrom_device +{ +public: + // construction/destruction + nes_karaokestudio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // device-level overrides + virtual void device_start(); + virtual ioport_constructor device_input_ports() const; + virtual DECLARE_WRITE8_MEMBER(write_h); + virtual DECLARE_READ8_MEMBER(read_m); + + virtual void pcb_reset(); + + required_ioport m_mic_ipt; +}; + + +// device type definition +extern const device_type NES_KARAOKESTUDIO; + +#endif diff --git a/src/mess/mess.mak b/src/mess/mess.mak index 45790124baa..9db1d0aa161 100644 --- a/src/mess/mess.mak +++ b/src/mess/mess.mak @@ -1554,6 +1554,7 @@ $(MESSOBJ)/nintendo.a: \ $(MESS_MACHINE)/nes_jaleco.o \ $(MESS_MACHINE)/nes_jy.o \ $(MESS_MACHINE)/nes_kaiser.o \ + $(MESS_MACHINE)/nes_karastudio.o \ $(MESS_MACHINE)/nes_konami.o \ $(MESS_AUDIO)/vrc6.o \ $(MESS_MACHINE)/nes_legacy.o \