From 1611b501e87b72af13ab6f9ce50f829354d68948 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Fri, 9 Oct 2020 19:46:36 +1100 Subject: [PATCH] amust: removed anonymous timer --- src/mame/drivers/amust.cpp | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/mame/drivers/amust.cpp b/src/mame/drivers/amust.cpp index 7441b4a3033..e62018b31fa 100644 --- a/src/mame/drivers/amust.cpp +++ b/src/mame/drivers/amust.cpp @@ -85,6 +85,7 @@ ToDo: #include "bus/rs232/rs232.h" #include "machine/upd765.h" #include "sound/beep.h" +#include "machine/timer.h" #include "video/mc6845.h" #include "emupal.h" #include "screen.h" @@ -106,16 +107,12 @@ public: , m_fdc (*this, "fdc") , m_floppy0(*this, "fdc:0") , m_floppy1(*this, "fdc:1") + , m_beep_timer(*this, "beep_timer") { } void amust(machine_config &config); private: - enum - { - TIMER_BEEP_OFF - }; - u8 port04_r(); void port04_w(u8 data); u8 port05_r(); @@ -133,6 +130,7 @@ private: DECLARE_WRITE_LINE_MEMBER(intrq_w); void kbd_put(u8 data); MC6845_UPDATE_ROW(crtc_update_row); + TIMER_DEVICE_CALLBACK_MEMBER(beep_timer); void io_map(address_map &map); void mem_map(address_map &map); @@ -151,7 +149,6 @@ private: bool m_hsync; bool m_vsync; std::unique_ptr m_vram; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; memory_passthrough_handler *m_rom_shadow_tap; required_device m_palette; required_device m_maincpu; @@ -163,18 +160,12 @@ private: required_device m_fdc; required_device m_floppy0; required_device m_floppy1; + required_device m_beep_timer; }; -void amust_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +TIMER_DEVICE_CALLBACK_MEMBER(amust_state::beep_timer) { - switch (id) - { - case TIMER_BEEP_OFF: - m_beep->set_state(0); - break; - default: - throw emu_fatalerror("Unknown id in amust_state::device_timer"); - } + m_beep->set_state(0); } //void amust_state::port00_w(u8 data) @@ -346,7 +337,7 @@ void amust_state::port0a_w(u8 data) if (!BIT(data, 4)) { m_beep->set_state(1); - timer_set(attotime::from_msec(150), TIMER_BEEP_OFF); + m_beep_timer->adjust(attotime::from_msec(150)); } floppy_image_device *floppy = m_floppy0->get_device(); m_fdc->set_floppy(floppy); @@ -480,6 +471,7 @@ void amust_state::amust(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); BEEP(config, m_beep, 800).add_route(ALL_OUTPUTS, "mono", 0.50); + TIMER(config, m_beep_timer).configure_generic(FUNC(amust_state::beep_timer)); /* Devices */ hd6845s_device &crtc(HD6845S(config, "crtc", XTAL(14'318'181) / 8));