From ec72ebc33eb448b38e0ec62b2cd52810b6547e85 Mon Sep 17 00:00:00 2001 From: Wilbert Pol Date: Tue, 20 May 2014 20:17:06 +0000 Subject: [PATCH] (MESS) msx.c: Added preliminary msx audio support. (nw) --- .gitattributes | 2 + hash/msx1_cart.xml | 12 +++++ src/emu/bus/bus.mak | 1 + src/emu/bus/msx_cart/cartridge.c | 2 + src/emu/bus/msx_cart/msx_audio.c | 75 ++++++++++++++++++++++++++++++++ src/emu/bus/msx_cart/msx_audio.h | 35 +++++++++++++++ src/mess/mess.mak | 2 +- 7 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 src/emu/bus/msx_cart/msx_audio.c create mode 100644 src/emu/bus/msx_cart/msx_audio.h diff --git a/.gitattributes b/.gitattributes index 542dd7a60ec..4f27f8730ad 100644 --- a/.gitattributes +++ b/.gitattributes @@ -991,6 +991,8 @@ src/emu/bus/msx_cart/korean.c svneol=native#text/plain src/emu/bus/msx_cart/korean.h svneol=native#text/plain src/emu/bus/msx_cart/majutsushi.c svneol=native#text/plain src/emu/bus/msx_cart/majutsushi.h svneol=native#text/plain +src/emu/bus/msx_cart/msx_audio.c svneol=native#text/plain +src/emu/bus/msx_cart/msx_audio.h svneol=native#text/plain src/emu/bus/msx_cart/msxdos2.c svneol=native#text/plain src/emu/bus/msx_cart/msxdos2.h svneol=native#text/plain src/emu/bus/msx_cart/nomapper.c svneol=native#text/plain diff --git a/hash/msx1_cart.xml b/hash/msx1_cart.xml index e96335fc2b6..15050e35d9e 100644 --- a/hash/msx1_cart.xml +++ b/hash/msx1_cart.xml @@ -17025,6 +17025,18 @@ kept for now until finding out what those bytes affect... + + Philips NMS-1205 Music Module + 198? + Philips + + + + + + + + diff --git a/src/emu/bus/bus.mak b/src/emu/bus/bus.mak index a0403473b6d..7e65837bcad 100644 --- a/src/emu/bus/bus.mak +++ b/src/emu/bus/bus.mak @@ -414,6 +414,7 @@ BUSOBJS += $(BUSOBJ)/msx_cart/fmpac.o BUSOBJS += $(BUSOBJ)/msx_cart/konami.o BUSOBJS += $(BUSOBJ)/msx_cart/korean.o BUSOBJS += $(BUSOBJ)/msx_cart/majutsushi.o +BUSOBJS += $(BUSOBJ)/msx_cart/msx_audio.o BUSOBJS += $(BUSOBJ)/msx_cart/msxdos2.o BUSOBJS += $(BUSOBJ)/msx_cart/nomapper.o BUSOBJS += $(BUSOBJ)/msx_cart/rtype.o diff --git a/src/emu/bus/msx_cart/cartridge.c b/src/emu/bus/msx_cart/cartridge.c index 6c724982526..38cadc344e8 100644 --- a/src/emu/bus/msx_cart/cartridge.c +++ b/src/emu/bus/msx_cart/cartridge.c @@ -7,6 +7,7 @@ #include "konami.h" #include "korean.h" #include "majutsushi.h" +#include "msx_audio.h" #include "msxdos2.h" #include "nomapper.h" #include "rtype.h" @@ -35,6 +36,7 @@ SLOT_INTERFACE_START(msx_cart) SLOT_INTERFACE_INTERNAL("korean_126in1", MSX_CART_KOREAN_126IN1) SLOT_INTERFACE_INTERNAL("sound_snatcher", MSX_CART_SOUND_SNATCHER) SLOT_INTERFACE_INTERNAL("sound_sdsnatch", MSX_CART_SOUND_SDSNATCHER) + SLOT_INTERFACE_INTERNAL("msx_audio", MSX_CART_MSX_AUDIO) SLOT_INTERFACE_END diff --git a/src/emu/bus/msx_cart/msx_audio.c b/src/emu/bus/msx_cart/msx_audio.c new file mode 100644 index 00000000000..3a05cce7c61 --- /dev/null +++ b/src/emu/bus/msx_cart/msx_audio.c @@ -0,0 +1,75 @@ +/********************************************************************************** + +**********************************************************************************/ + +#include "emu.h" +#include "msx_audio.h" + +const device_type MSX_CART_MSX_AUDIO = &device_creator; + + +msx_cart_msx_audio::msx_cart_msx_audio(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MSX_CART_MSX_AUDIO, "MSX Cartridge - MSX-AUDIO", tag, owner, clock, "msx_cart_msx_audio", __FILE__) + , msx_cart_interface(mconfig, *this) + , m_y8950(*this, "y8950") + , m_acia6850(*this, "acia6850") +{ +} + + +static MACHINE_CONFIG_FRAGMENT( msx_audio ) + // There is a 2 MHz crystal on the PCB, where does it go? + + // This is actually incorrect. The sound output is passed back into the MSX machine where it is mixed internally and output through the system 'speaker'. + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("y8950", Y8950, XTAL_3_579545MHz) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) + + MCFG_DEVICE_ADD("acia6850", ACIA6850, 0) +MACHINE_CONFIG_END + + +machine_config_constructor msx_cart_msx_audio::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( msx_audio ); +} + + +void msx_cart_msx_audio::device_start() +{ + // Install IO read/write handlers + address_space &space = machine().device("maincpu")->space(AS_IO); + space.install_write_handler(0xc0, 0xc1, write8_delegate(FUNC(msx_cart_msx_audio::write_y8950), this)); + space.install_read_handler(0xc0, 0xc1, read8_delegate(FUNC(msx_cart_msx_audio::read_y8950), this)); +} + + +void msx_cart_msx_audio::initialize_cartridge() +{ + if ( get_rom_size() != 0x8000 ) + { + fatalerror("msx_audio: Invalid ROM size\n"); + } +} + + +READ8_MEMBER(msx_cart_msx_audio::read_cart) +{ + if (offset >= 0x4000 && offset < 0xC000) + { + return m_rom[offset - 0x4000]; + } + return 0xff; +} + + +WRITE8_MEMBER(msx_cart_msx_audio::write_y8950) +{ + m_y8950->write(space, offset, data); +} + +READ8_MEMBER(msx_cart_msx_audio::read_y8950) +{ + return m_y8950->read(space, offset); +} + diff --git a/src/emu/bus/msx_cart/msx_audio.h b/src/emu/bus/msx_cart/msx_audio.h new file mode 100644 index 00000000000..46505d39c87 --- /dev/null +++ b/src/emu/bus/msx_cart/msx_audio.h @@ -0,0 +1,35 @@ +#ifndef __MSX_CART_MSX_AUDIO_H +#define __MSX_CART_MSX_AUDIO_H + +#include "bus/msx_cart/cartridge.h" +#include "sound/8950intf.h" +#include "machine/6850acia.h" + + +extern const device_type MSX_CART_MSX_AUDIO; + + +class msx_cart_msx_audio : public device_t + , public msx_cart_interface +{ +public: + msx_cart_msx_audio(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // device-level overrides + virtual void device_start(); + virtual machine_config_constructor device_mconfig_additions() const; + + virtual void initialize_cartridge(); + + virtual DECLARE_READ8_MEMBER(read_cart); + + DECLARE_WRITE8_MEMBER(write_y8950); + DECLARE_READ8_MEMBER(read_y8950); + +private: + required_device m_y8950; + required_device m_acia6850; +}; + + +#endif diff --git a/src/mess/mess.mak b/src/mess/mess.mak index da92922144b..3370d5ab103 100644 --- a/src/mess/mess.mak +++ b/src/mess/mess.mak @@ -153,7 +153,7 @@ SOUNDS += YM2612 #SOUNDS += YM3438 SOUNDS += YM3812 SOUNDS += YM3526 -#SOUNDS += Y8950 +SOUNDS += Y8950 SOUNDS += YMF262 #SOUNDS += YMF271 #SOUNDS += YMF278B