From 45bd48fe24d7dc4aa487c23572bc26de4211d413 Mon Sep 17 00:00:00 2001 From: AJR Date: Sat, 16 Mar 2019 21:14:28 -0400 Subject: apollo: Make beeper subdevice of keyboard; eliminate associated machine().device call (nw) --- src/mame/drivers/apollo.cpp | 22 ---------------------- src/mame/machine/apollo_kbd.cpp | 16 +++++++++++++++- src/mame/machine/apollo_kbd.h | 2 ++ 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/src/mame/drivers/apollo.cpp b/src/mame/drivers/apollo.cpp index 0a1a3d6cc54..eb071504cbc 100644 --- a/src/mame/drivers/apollo.cpp +++ b/src/mame/drivers/apollo.cpp @@ -29,14 +29,12 @@ #include "includes/apollo.h" #include "cpu/m68000/m68000.h" -#include "sound/beep.h" // we use set_verbose #include "bus/isa/omti8621.h" #include "bus/isa/3c505.h" #include "debugger.h" -#include "speaker.h" #include "apollo_dsp.lh" @@ -1054,11 +1052,6 @@ MACHINE_CONFIG_START(apollo_state::dn3500) apollo(config); - /* keyboard beeper */ - SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("beep", BEEP, 1000) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - /* internal ram */ RAM(config, m_ram).set_default_size("8M").set_extra_options("4M,8M,16M,32M"); @@ -1076,11 +1069,6 @@ MACHINE_CONFIG_START(apollo_state::dsp3500) apollo_terminal(config); - /* keyboard beeper */ - SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("beep", BEEP, 1000) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - /* internal ram */ RAM(config, RAM_TAG).set_default_size("8M").set_extra_options("4M,8M,16M,32M"); @@ -1128,11 +1116,6 @@ MACHINE_CONFIG_START(apollo_state::dsp3000) apollo_terminal(config); - /* keyboard beeper */ - SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("beep", BEEP, 1000) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - /* internal ram */ RAM(config, m_ram).set_default_size("8M").set_extra_options("4M"); @@ -1176,11 +1159,6 @@ MACHINE_CONFIG_START(apollo_state::dsp5500) apollo_terminal(config); - /* keyboard beeper */ - SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("beep", BEEP, 1000) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - /* internal ram */ // FIXME: guess, to fix validation RAM(config, RAM_TAG).set_default_size("8M").set_extra_options("4M,8M,16M,32M"); diff --git a/src/mame/machine/apollo_kbd.cpp b/src/mame/machine/apollo_kbd.cpp index 13e3ba485b8..a3d99e7ce2e 100644 --- a/src/mame/machine/apollo_kbd.cpp +++ b/src/mame/machine/apollo_kbd.cpp @@ -15,6 +15,7 @@ #define VERBOSE 0 #include "machine/apollo_kbd.h" +#include "speaker.h" #define LOG(x) { m_device->logerror ("%s apollo_kbd: ", m_device->cpu_context()); m_device->logerror x; m_device->logerror ("\n"); } @@ -188,6 +189,7 @@ DEFINE_DEVICE_TYPE(APOLLO_KBD, apollo_kbd_device, "apollo_kbd", "Apollo Keyboard apollo_kbd_device::apollo_kbd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, APOLLO_KBD, tag, owner, clock) , device_serial_interface(mconfig, *this) + , m_beep(*this, "beep") , m_io_keyboard(*this, "keyboard%u", 1U) , m_io_mouse(*this, "mouse%u", 1U) , m_tx_w(*this) @@ -195,6 +197,18 @@ apollo_kbd_device::apollo_kbd_device(const machine_config &mconfig, const char * { } +//------------------------------------------------- +// device_add_mconfig - add device-specific +// machine configuration +//------------------------------------------------- + +void apollo_kbd_device::device_add_mconfig(machine_config &config) +{ + /* keyboard beeper */ + SPEAKER(config, "mono").front_center(); + BEEP(config, m_beep, 1000).add_route(ALL_OUTPUTS, "mono", 1.00); +} + //------------------------------------------------- // device_input_ports - device-specific ports //------------------------------------------------- @@ -300,7 +314,7 @@ void apollo_kbd_device::beeper::start(apollo_kbd_device *device) { m_device = device; LOG2(("start apollo_kbd::beeper")); - m_beeper = m_device->machine().device("beep"); + m_beeper = m_device->m_beep.target(); m_timer = m_device->machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apollo_kbd_device::beeper::beeper_callback), this)); } diff --git a/src/mame/machine/apollo_kbd.h b/src/mame/machine/apollo_kbd.h index a7343470a3d..35a2720215b 100644 --- a/src/mame/machine/apollo_kbd.h +++ b/src/mame/machine/apollo_kbd.h @@ -46,6 +46,7 @@ public: private: // device-level overrides virtual ioport_constructor device_input_ports() const override; + virtual void device_add_mconfig(machine_config &config) override; virtual void device_resolve_objects() override; virtual void device_start() override; virtual void device_reset() override; @@ -110,6 +111,7 @@ private: static const int XMIT_RING_SIZE = 64; + required_device m_beep; required_ioport_array<4> m_io_keyboard; required_ioport_array<3> m_io_mouse; -- cgit v1.2.3