From 9b1c2dfc19c5a248286d94c4f42c4cb821f0d9f6 Mon Sep 17 00:00:00 2001 From: Wilbert Pol Date: Thu, 22 May 2014 19:04:16 +0000 Subject: [PATCH] (MESS) msx.c: Some small msx audio changes. Renamed the msx audio soft list sets. (nw) --- hash/msx1_cart.xml | 36 +++--- src/emu/bus/msx_cart/cartridge.c | 4 +- src/emu/bus/msx_cart/msx_audio.c | 205 ++++++++++++++++++++++++++++--- src/emu/bus/msx_cart/msx_audio.h | 54 +++++++- 4 files changed, 260 insertions(+), 39 deletions(-) diff --git a/hash/msx1_cart.xml b/hash/msx1_cart.xml index d1186b4816f..a9b0e069291 100644 --- a/hash/msx1_cart.xml +++ b/hash/msx1_cart.xml @@ -14508,24 +14508,27 @@ kept for now until finding out what those bytes affect... - + Panasonic FS-CA1 MSX-Audio + BASIC (Jpn) 1988 Panasonic + + + - + Toshiba HX-MU900 MSX-Audio 1985 Toshiba - + @@ -14533,6 +14536,20 @@ kept for now until finding out what those bytes affect... + + Philips NMS-1205 Music Module + 198? + Philips + + + + + + + + + + National FS-SR022 MSX-Jisho (Jpn) @@ -17026,18 +17043,5 @@ kept for now until finding out what those bytes affect... - - Philips NMS-1205 Music Module - 198? - Philips - - - - - - - - - diff --git a/src/emu/bus/msx_cart/cartridge.c b/src/emu/bus/msx_cart/cartridge.c index 38cadc344e8..905fb25d136 100644 --- a/src/emu/bus/msx_cart/cartridge.c +++ b/src/emu/bus/msx_cart/cartridge.c @@ -36,7 +36,9 @@ 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_INTERNAL("msxaud_hxmu900", MSX_CART_MSX_AUDIO_HXMU900) + SLOT_INTERFACE_INTERNAL("msxaud_fsca1", MSX_CART_MSX_AUDIO_FSCA1) + SLOT_INTERFACE_INTERNAL("msxaud_nms1205", MSX_CART_MSX_AUDIO_NMS1205) SLOT_INTERFACE_END diff --git a/src/emu/bus/msx_cart/msx_audio.c b/src/emu/bus/msx_cart/msx_audio.c index 3a05cce7c61..6f29aa61016 100644 --- a/src/emu/bus/msx_cart/msx_audio.c +++ b/src/emu/bus/msx_cart/msx_audio.c @@ -1,15 +1,84 @@ /********************************************************************************** +Emulation of the different MSX-AUDIO devices: + +- Panasonic FS-CA1 + - Y8950 + - 4KB ram + +- Toshiba HX-MU900 + - Y8950 + - No midi ports + - No ram + +- Philips NMS-1205 + - Y8950 + - Midi ports + - 32KB sample ram + **********************************************************************************/ #include "emu.h" #include "msx_audio.h" -const device_type MSX_CART_MSX_AUDIO = &device_creator; +const device_type MSX_CART_MSX_AUDIO_HXMU900 = &device_creator; +const device_type MSX_CART_MSX_AUDIO_NMS1205 = &device_creator; +const device_type MSX_CART_MSX_AUDIO_FSCA1 = &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_msx_audio_hxmu900::msx_cart_msx_audio_hxmu900(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MSX_CART_MSX_AUDIO_HXMU900, "MSX Cartridge - MSX-AUDIO HX-MU900", tag, owner, clock, "msx_audio_hxmu900", __FILE__) + , msx_cart_interface(mconfig, *this) + , m_y8950(*this, "y8950") +{ +} + + +static MACHINE_CONFIG_FRAGMENT( msx_audio_hxmu900 ) + // 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) // Not verified + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) +MACHINE_CONFIG_END + + +machine_config_constructor msx_cart_msx_audio_hxmu900::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( msx_audio_hxmu900 ); +} + + +void msx_cart_msx_audio_hxmu900::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(y8950_device::write), m_y8950.target())); + space.install_read_handler(0xc0, 0xc1, read8_delegate(FUNC(y8950_device::read), m_y8950.target())); +} + + +void msx_cart_msx_audio_hxmu900::initialize_cartridge() +{ + if (get_rom_size() < 0x8000) + { + fatalerror("msx_audio: Invalid ROM size\n"); + } +} + + +READ8_MEMBER(msx_cart_msx_audio_hxmu900::read_cart) +{ + if (offset >= 0x4000 && offset < 0xC000) + { + return m_rom[offset - 0x4000]; + } + return 0xff; +} + + + +msx_cart_msx_audio_nms1205::msx_cart_msx_audio_nms1205(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MSX_CART_MSX_AUDIO_NMS1205, "MSX Cartridge - MSX-AUDIO NMS-1205", tag, owner, clock, "msx_audio_nms1205", __FILE__) , msx_cart_interface(mconfig, *this) , m_y8950(*this, "y8950") , m_acia6850(*this, "acia6850") @@ -17,7 +86,7 @@ msx_cart_msx_audio::msx_cart_msx_audio(const machine_config &mconfig, const char } -static MACHINE_CONFIG_FRAGMENT( msx_audio ) +static MACHINE_CONFIG_FRAGMENT( msx_audio_nms1205 ) // 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'. @@ -29,31 +98,31 @@ static MACHINE_CONFIG_FRAGMENT( msx_audio ) MACHINE_CONFIG_END -machine_config_constructor msx_cart_msx_audio::device_mconfig_additions() const +machine_config_constructor msx_cart_msx_audio_nms1205::device_mconfig_additions() const { - return MACHINE_CONFIG_NAME( msx_audio ); + return MACHINE_CONFIG_NAME( msx_audio_nms1205 ); } -void msx_cart_msx_audio::device_start() +void msx_cart_msx_audio_nms1205::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)); + space.install_write_handler(0xc0, 0xc1, write8_delegate(FUNC(y8950_device::write), m_y8950.target())); + space.install_read_handler(0xc0, 0xc1, read8_delegate(FUNC(y8950_device::read), m_y8950.target())); } -void msx_cart_msx_audio::initialize_cartridge() +void msx_cart_msx_audio_nms1205::initialize_cartridge() { - if ( get_rom_size() != 0x8000 ) + if (get_rom_size() < 0x8000) { fatalerror("msx_audio: Invalid ROM size\n"); } } -READ8_MEMBER(msx_cart_msx_audio::read_cart) +READ8_MEMBER(msx_cart_msx_audio_nms1205::read_cart) { if (offset >= 0x4000 && offset < 0xC000) { @@ -63,13 +132,117 @@ READ8_MEMBER(msx_cart_msx_audio::read_cart) } -WRITE8_MEMBER(msx_cart_msx_audio::write_y8950) + + + + +msx_cart_msx_audio_fsca1::msx_cart_msx_audio_fsca1(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MSX_CART_MSX_AUDIO_FSCA1, "MSX Cartridge - MSX-AUDIO FS-CA1", tag, owner, clock, "msx_audio_fsca1", __FILE__) + , msx_cart_interface(mconfig, *this) + , m_y8950(*this, "y8950") + , m_7ffe(0) + , m_7fff(0) { - m_y8950->write(space, offset, data); } -READ8_MEMBER(msx_cart_msx_audio::read_y8950) + +static MACHINE_CONFIG_FRAGMENT( msx_audio_fsca1 ) + // 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) +MACHINE_CONFIG_END + + +machine_config_constructor msx_cart_msx_audio_fsca1::device_mconfig_additions() const { - return m_y8950->read(space, offset); + return MACHINE_CONFIG_NAME( msx_audio_fsca1 ); +} + + +void msx_cart_msx_audio_fsca1::device_start() +{ + // Install IO read/write handlers + address_space &space = machine().device("maincpu")->space(AS_IO); + space.install_write_handler(0xc0, 0xc3, write8_delegate(FUNC(msx_cart_msx_audio_fsca1::write_y8950), this)); + space.install_read_handler(0xc0, 0xc3, read8_delegate(FUNC(msx_cart_msx_audio_fsca1::read_y8950), this)); +} + + +void msx_cart_msx_audio_fsca1::initialize_cartridge() +{ + if (get_rom_size() != 0x20000) + { + fatalerror("msx_audio_fsca1: Invalid ROM size\n"); + } +} + + +READ8_MEMBER(msx_cart_msx_audio_fsca1::read_cart) +{ + if (offset < 0x8000) + { + if ((offset & 0x3000) == 0x3000) + { + return m_ram[offset & 0xfff]; + } + return m_rom[offset]; + } + return 0xff; +} + + +WRITE8_MEMBER(msx_cart_msx_audio_fsca1::write_cart) +{ + if (offset == 0x7ffe) + { + m_7ffe = data; + return; + } + + if (offset == 0x7fff) + { + m_7fff = data; + return; + } + + if ((offset & 0xb000) == 0x3000) + { + m_ram[offset & 0xfff] = data; + return; + } + + printf("msx_cart_msx_audio_fsca1: Unhandled write %02x to %04x\n", data, offset); +} + + +WRITE8_MEMBER(msx_cart_msx_audio_fsca1::write_y8950) +{ + if (offset & 2) + { + if (m_7fff & 0x02) + { + m_y8950->write(space, offset, data); + } + } + else + { + if (m_7fff & 0x01) + { + m_y8950->write(space, offset, data); + } + } +} + +READ8_MEMBER(msx_cart_msx_audio_fsca1::read_y8950) +{ + if (offset & 2) + { + return (m_7fff & 0x02) ? m_y8950->read(space, offset) : 0xff; + } + else + { + return (m_7fff & 0x01) ? m_y8950->read(space, offset) : 0xff; + } } diff --git a/src/emu/bus/msx_cart/msx_audio.h b/src/emu/bus/msx_cart/msx_audio.h index 46505d39c87..066c4a50c38 100644 --- a/src/emu/bus/msx_cart/msx_audio.h +++ b/src/emu/bus/msx_cart/msx_audio.h @@ -6,14 +6,16 @@ #include "machine/6850acia.h" -extern const device_type MSX_CART_MSX_AUDIO; +extern const device_type MSX_CART_MSX_AUDIO_NMS1205; +extern const device_type MSX_CART_MSX_AUDIO_HXMU900; +extern const device_type MSX_CART_MSX_AUDIO_FSCA1; -class msx_cart_msx_audio : public device_t - , public msx_cart_interface +class msx_cart_msx_audio_hxmu900 : public device_t + , public msx_cart_interface { public: - msx_cart_msx_audio(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + msx_cart_msx_audio_hxmu900(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); // device-level overrides virtual void device_start(); @@ -23,8 +25,24 @@ public: virtual DECLARE_READ8_MEMBER(read_cart); - DECLARE_WRITE8_MEMBER(write_y8950); - DECLARE_READ8_MEMBER(read_y8950); +private: + required_device m_y8950; +}; + + +class msx_cart_msx_audio_nms1205 : public device_t + , public msx_cart_interface +{ +public: + msx_cart_msx_audio_nms1205(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); private: required_device m_y8950; @@ -32,4 +50,28 @@ private: }; +class msx_cart_msx_audio_fsca1 : public device_t + , public msx_cart_interface +{ +public: + msx_cart_msx_audio_fsca1(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); + virtual DECLARE_WRITE8_MEMBER(write_cart); + + DECLARE_WRITE8_MEMBER(write_y8950); + DECLARE_READ8_MEMBER(read_y8950); + +private: + required_device m_y8950; + UINT8 m_7ffe; + UINT8 m_7fff; +}; + #endif