apollo: Make beeper subdevice of keyboard; eliminate associated machine().device call (nw)

This commit is contained in:
AJR 2019-03-16 21:14:28 -04:00
parent 783a4188de
commit 45bd48fe24
3 changed files with 17 additions and 23 deletions

View File

@ -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");

View File

@ -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_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));
}

View File

@ -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<beep_device> m_beep;
required_ioport_array<4> m_io_keyboard;
required_ioport_array<3> m_io_mouse;