From b07f072cf542ae9c4f8a0baad73d1650b88fdff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Banaan=20Ananas?= Date: Fri, 24 Jan 2014 23:12:50 +0000 Subject: [PATCH] modernized taito zm --- src/mame/audio/taito_zm.c | 96 ++++++++++++++++++++++++++++++-------- src/mame/audio/taito_zm.h | 32 +++++++++++++ src/mame/drivers/taitogn.c | 6 ++- 3 files changed, 112 insertions(+), 22 deletions(-) diff --git a/src/mame/audio/taito_zm.c b/src/mame/audio/taito_zm.c index 4831ddf3244..fc36bf81411 100644 --- a/src/mame/audio/taito_zm.c +++ b/src/mame/audio/taito_zm.c @@ -7,30 +7,69 @@ Copyright Nicola Salmoria and the MAME Team. Visit http://mamedev.org for licensing and usage restrictions. +TODO: +- add TMS57002 +- a lot more + ***************************************************************************/ #include "emu.h" -#include "cpu/mn10200/mn10200.h" -#include "cpu/tms57002/tms57002.h" -#include "audio/taito_zm.h" -#include "sound/zsg2.h" +#include "taito_zm.h" -static ADDRESS_MAP_START(taitozoom_map, AS_PROGRAM, 16, driver_device ) - AM_RANGE(0x080000, 0x0fffff) AM_ROM AM_REGION("mn10200", 0) - AM_RANGE(0x400000, 0x40ffff) AM_RAM - AM_RANGE(0x800000, 0x800fff) AM_DEVREADWRITE("zsg2", zsg2_device, zsg2_r, zsg2_w) - AM_RANGE(0xe00000, 0xe000ff) AM_RAM // main CPU comms (1fbe0xxx on FX-1B main CPU, banked with eeprom - raystorm writes command at PC=80015240) - AM_RANGE(0xc00000, 0xc00001) AM_RAM // TMS57002 comms -ADDRESS_MAP_END +/**************************************************************************/ -static UINT8 tms_ctrl; +const device_type TAITO_ZOOM = &device_creator; -static READ8_HANDLER(tms_ctrl_r) +taito_zoom_device::taito_zoom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TAITO_ZOOM, "Taito Zoom Sound System", tag, owner, clock, "taito_zoom", __FILE__), + m_tms_ctrl(0) { - return tms_ctrl; + memset(m_snd_shared_ram, 0, 0x100); } -static WRITE8_HANDLER(tms_ctrl_w) +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void taito_zoom_device::device_start() +{ + // register for savestates + save_item(NAME(m_tms_ctrl)); + save_item(NAME(m_snd_shared_ram)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void taito_zoom_device::device_reset() +{ +} + + +/*************************************************************************** + + MN10200 I/O and Memory Map + +***************************************************************************/ + +READ8_MEMBER(taito_zoom_device::shared_ram_r) +{ + return m_snd_shared_ram[offset]; +} + +WRITE8_MEMBER(taito_zoom_device::shared_ram_w) +{ + m_snd_shared_ram[offset] = data; +} + + +READ8_MEMBER(taito_zoom_device::tms_ctrl_r) +{ + return m_tms_ctrl; +} + +WRITE8_MEMBER(taito_zoom_device::tms_ctrl_w) { #if 0 tms57002_reset_w(data & 4); @@ -38,26 +77,43 @@ static WRITE8_HANDLER(tms_ctrl_w) tms57002_pload_w(data & 1); #endif - tms_ctrl = data; + m_tms_ctrl = data; } -static ADDRESS_MAP_START(taitozoom_io_map, AS_IO, 8, driver_device ) - AM_RANGE(MN10200_PORT1, MN10200_PORT1) AM_READWRITE_LEGACY(tms_ctrl_r, tms_ctrl_w) + +static ADDRESS_MAP_START(taitozoom_map, AS_PROGRAM, 16, driver_device ) + AM_RANGE(0x080000, 0x0fffff) AM_ROM AM_REGION("mn10200", 0) + AM_RANGE(0x400000, 0x40ffff) AM_RAM + AM_RANGE(0x800000, 0x800fff) AM_DEVREADWRITE("zsg2", zsg2_device, zsg2_r, zsg2_w) + AM_RANGE(0xe00000, 0xe000ff) AM_DEVREADWRITE8("taito_zoom", taito_zoom_device, shared_ram_r, shared_ram_w, 0xffff) // // M66220FP for comms with maincpu + AM_RANGE(0xc00000, 0xc00001) AM_RAM // TMS57002 comms ADDRESS_MAP_END +static ADDRESS_MAP_START(taitozoom_io_map, AS_IO, 8, driver_device ) + AM_RANGE(MN10200_PORT1, MN10200_PORT1) AM_DEVREADWRITE("taito_zoom", taito_zoom_device, tms_ctrl_r, tms_ctrl_w) +ADDRESS_MAP_END + + +/*************************************************************************** + + Machine Config + +***************************************************************************/ + static const zsg2_interface zsg2_taito_config = { "zsg2" /* sample region */ }; MACHINE_CONFIG_FRAGMENT( taito_zoom_sound ) - MCFG_CPU_ADD("mn10200", MN10200, 25000000/2) + MCFG_TAITO_ZOOM_ADD("taito_zoom") + MCFG_CPU_ADD("mn10200", MN10200, XTAL_25MHz/2) MCFG_CPU_PROGRAM_MAP(taitozoom_map) MCFG_CPU_IO_MAP(taitozoom_io_map) // MCFG_CPU_VBLANK_INT("screen", irq0_line_pulse) // we assume the parent machine has created lspeaker/rspeaker - MCFG_ZSG2_ADD("zsg2", 25000000/2) + MCFG_ZSG2_ADD("zsg2", XTAL_25MHz/2) MCFG_SOUND_CONFIG(zsg2_taito_config) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) diff --git a/src/mame/audio/taito_zm.h b/src/mame/audio/taito_zm.h index f9c34c60712..353566a065f 100644 --- a/src/mame/audio/taito_zm.h +++ b/src/mame/audio/taito_zm.h @@ -1 +1,33 @@ +#include "cpu/mn10200/mn10200.h" +#include "cpu/tms57002/tms57002.h" +#include "sound/zsg2.h" + +class taito_zoom_device : public device_t + +{ +public: + taito_zoom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~taito_zoom_device() {} + + DECLARE_READ8_MEMBER(shared_ram_r); + DECLARE_WRITE8_MEMBER(shared_ram_w); + DECLARE_READ8_MEMBER(tms_ctrl_r); + DECLARE_WRITE8_MEMBER(tms_ctrl_w); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + +private: + // internal state + UINT8 m_tms_ctrl; + UINT8 m_snd_shared_ram[0x100]; +}; + +extern const device_type TAITO_ZOOM; + MACHINE_CONFIG_EXTERN( taito_zoom_sound ); + +#define MCFG_TAITO_ZOOM_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, TAITO_ZOOM, 0) diff --git a/src/mame/drivers/taitogn.c b/src/mame/drivers/taitogn.c index 29177478932..6008aac7c7a 100644 --- a/src/mame/drivers/taitogn.c +++ b/src/mame/drivers/taitogn.c @@ -342,7 +342,8 @@ public: m_maincpu(*this, "maincpu"), m_mn10200(*this, "mn10200"), m_flashbank(*this, "flashbank"), - m_mb3773(*this, "mb3773") + m_mb3773(*this, "mb3773"), + m_zoom(*this, "taito_zoom") { } @@ -382,6 +383,7 @@ private: required_device m_mn10200; required_device m_flashbank; required_device m_mb3773; + required_device m_zoom; }; @@ -578,7 +580,7 @@ static ADDRESS_MAP_START( taitogn_map, AS_PROGRAM, 32, taitogn_state ) AM_RANGE(0x1fb40000, 0x1fb40003) AM_READWRITE8(control_r, control_w, 0x000000ff) AM_RANGE(0x1fb60000, 0x1fb60003) AM_WRITE16(control2_w, 0x0000ffff) AM_RANGE(0x1fb70000, 0x1fb70003) AM_READWRITE16(gn_1fb70000_r, gn_1fb70000_w, 0x0000ffff) - AM_RANGE(0x1fbe0000, 0x1fbe01ff) AM_RAM // 256 bytes com zone with the mn102, low bytes of words only, with additional comm at 1fb80000 + AM_RANGE(0x1fbe0000, 0x1fbe01ff) AM_DEVREADWRITE8("taito_zoom", taito_zoom_device, shared_ram_r, shared_ram_w, 0x00ff00ff) // M66220FP for comms with the MN10200, with additional comms at 1fb80000 ADDRESS_MAP_END static ADDRESS_MAP_START( flashbank_map, AS_PROGRAM, 16, taitogn_state )