From 7f7ec353bfa77b75de79b994ffa3d38bbeb97d43 Mon Sep 17 00:00:00 2001 From: smf- Date: Tue, 25 Sep 2018 23:57:40 +0100 Subject: modernise (nw) --- src/mame/audio/segam1audio.cpp | 71 +++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 39 deletions(-) diff --git a/src/mame/audio/segam1audio.cpp b/src/mame/audio/segam1audio.cpp index 1dd071940b1..f3f5ea7273b 100644 --- a/src/mame/audio/segam1audio.cpp +++ b/src/mame/audio/segam1audio.cpp @@ -14,38 +14,30 @@ #include "machine/clock.h" #include "speaker.h" -#define M68000_TAG "sndcpu" -#define MULTIPCM_1_TAG "pcm1" -#define MULTIPCM_2_TAG "pcm2" -#define YM3438_TAG "ymsnd" -#define UART_TAG "uart" -#define MPCMBANK1_TAG "m1pcm1_bank" -#define MPCMBANK2_TAG "m1pcm2_bank" - void segam1audio_device::segam1audio_map(address_map &map) { map(0x000000, 0x03ffff).rom(); - map(0x080000, 0x09ffff).rom().region(M68000_TAG, 0x20000); // mirror of upper ROM socket - map(0xc20000, 0xc20003).rw(UART_TAG, FUNC(i8251_device::read), FUNC(i8251_device::write)).umask16(0x00ff); - map(0xc40000, 0xc40007).rw(MULTIPCM_1_TAG, FUNC(multipcm_device::read), FUNC(multipcm_device::write)).umask16(0x00ff); + map(0x080000, 0x09ffff).rom().region("sndcpu", 0x20000); // mirror of upper ROM socket + map(0xc20000, 0xc20003).rw(m_uart, FUNC(i8251_device::read), FUNC(i8251_device::write)).umask16(0x00ff); + map(0xc40000, 0xc40007).rw(m_multipcm_1, FUNC(multipcm_device::read), FUNC(multipcm_device::write)).umask16(0x00ff); map(0xc40012, 0xc40013).nopw(); map(0xc50000, 0xc50001).w(FUNC(segam1audio_device::m1_snd_mpcm_bnk1_w)); - map(0xc60000, 0xc60007).rw(MULTIPCM_2_TAG, FUNC(multipcm_device::read), FUNC(multipcm_device::write)).umask16(0x00ff); + map(0xc60000, 0xc60007).rw(m_multipcm_2, FUNC(multipcm_device::read), FUNC(multipcm_device::write)).umask16(0x00ff); map(0xc70000, 0xc70001).w(FUNC(segam1audio_device::m1_snd_mpcm_bnk2_w)); - map(0xd00000, 0xd00007).rw(YM3438_TAG, FUNC(ym3438_device::read), FUNC(ym3438_device::write)).umask16(0x00ff); + map(0xd00000, 0xd00007).rw(m_ym, FUNC(ym3438_device::read), FUNC(ym3438_device::write)).umask16(0x00ff); map(0xf00000, 0xf0ffff).ram(); } void segam1audio_device::mpcm1_map(address_map &map) { map(0x000000, 0x0fffff).rom(); - map(0x100000, 0x1fffff).bankr(MPCMBANK1_TAG); + map(0x100000, 0x1fffff).bankr(m_mpcmbank1); } void segam1audio_device::mpcm2_map(address_map &map) { map(0x000000, 0x0fffff).rom(); - map(0x100000, 0x1fffff).bankr(MPCMBANK2_TAG); + map(0x100000, 0x1fffff).bankr(m_mpcmbank2); } //************************************************************************** @@ -58,26 +50,27 @@ DEFINE_DEVICE_TYPE(SEGAM1AUDIO, segam1audio_device, "segam1audio", "Sega Model 1 // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(segam1audio_device::device_add_mconfig) - MCFG_DEVICE_ADD(M68000_TAG, M68000, 10000000) // verified on real h/w - MCFG_DEVICE_PROGRAM_MAP(segam1audio_map) +void segam1audio_device::device_add_mconfig(machine_config &config) +{ + M68000(config, m_audiocpu, 10000000); // verified on real h/w + m_audiocpu->set_addrmap(AS_PROGRAM, &segam1audio_device::segam1audio_map); SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - MCFG_DEVICE_ADD(YM3438_TAG, YM3438, 8000000) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.60) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.60) + YM3438(config, m_ym, 8000000); + m_ym->add_route(0, "lspeaker", 0.60); + m_ym->add_route(1, "rspeaker", 0.60); - MCFG_DEVICE_ADD(MULTIPCM_1_TAG, MULTIPCM, 8000000) - MCFG_DEVICE_ADDRESS_MAP(0, mpcm1_map) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + MULTIPCM(config, m_multipcm_1, 8000000); + m_multipcm_1->set_addrmap(0, &segam1audio_device::mpcm1_map); + m_multipcm_1->add_route(0, "lspeaker", 1.0); + m_multipcm_1->add_route(1, "rspeaker", 1.0); - MCFG_DEVICE_ADD(MULTIPCM_2_TAG, MULTIPCM, 8000000) - MCFG_DEVICE_ADDRESS_MAP(0, mpcm2_map) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + MULTIPCM(config, m_multipcm_2, 8000000); + m_multipcm_2->set_addrmap(0, &segam1audio_device::mpcm2_map); + m_multipcm_2->add_route(0, "lspeaker", 1.0); + m_multipcm_2->add_route(1, "rspeaker", 1.0); I8251(config, m_uart, 8000000); // T82C51, clock unknown m_uart->rxrdy_handler().set_inputline(m_audiocpu, M68K_IRQ_2); @@ -86,7 +79,7 @@ MACHINE_CONFIG_START(segam1audio_device::device_add_mconfig) clock_device &uart_clock(CLOCK(config, "uart_clock", 500000)); // 16 times 31.25MHz (standard Sega/MIDI sound data rate) uart_clock.signal_handler().set(m_uart, FUNC(i8251_device::write_txc)); uart_clock.signal_handler().append(m_uart, FUNC(i8251_device::write_rxc)); -MACHINE_CONFIG_END +} //************************************************************************** // LIVE DEVICE @@ -98,15 +91,15 @@ MACHINE_CONFIG_END segam1audio_device::segam1audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SEGAM1AUDIO, tag, owner, clock), - m_audiocpu(*this, M68000_TAG), - m_multipcm_1(*this, MULTIPCM_1_TAG), - m_multipcm_2(*this, MULTIPCM_2_TAG), - m_ym(*this, YM3438_TAG), - m_uart(*this, UART_TAG), - m_multipcm1_region(*this, MULTIPCM_1_TAG), - m_multipcm2_region(*this, MULTIPCM_2_TAG), - m_mpcmbank1(*this, MPCMBANK1_TAG), - m_mpcmbank2(*this, MPCMBANK2_TAG), + m_audiocpu(*this, "sndcpu"), + m_multipcm_1(*this, "pcm1"), + m_multipcm_2(*this, "pcm2"), + m_ym(*this, "ymsnd"), + m_uart(*this, "uart"), + m_multipcm1_region(*this, "pcm1"), + m_multipcm2_region(*this, "pcm2"), + m_mpcmbank1(*this, "m1pcm1_bank"), + m_mpcmbank2(*this, "m1pcm2_bank"), m_rxd_handler(*this) { } -- cgit v1.2.3