diff options
Diffstat (limited to 'src/devices/machine/saa1043.cpp')
-rw-r--r-- | src/devices/machine/saa1043.cpp | 53 |
1 files changed, 14 insertions, 39 deletions
diff --git a/src/devices/machine/saa1043.cpp b/src/devices/machine/saa1043.cpp index 48b1f168639..099041209a8 100644 --- a/src/devices/machine/saa1043.cpp +++ b/src/devices/machine/saa1043.cpp @@ -12,17 +12,18 @@ #include "emu.h" #include "saa1043.h" +#include <algorithm> + + DEFINE_DEVICE_TYPE(SAA1043, saa1043_device, "saa1043", "Philips SAA1043") /*static*/ const uint32_t saa1043_device::s_line_counts[4] = { 624, 624, 524, 524 }; saa1043_device::saa1043_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SAA1043, tag, owner, clock) - , m_outputs{ *this, *this, *this, *this, *this, *this, - *this, *this, *this, *this, *this, *this, - *this, *this, *this, *this, *this, *this } + , m_outputs(*this) + , m_type(PAL) { - memset(m_outputs_hooked, 0, sizeof(bool) * OUT_COUNT); } void saa1043_device::device_start() @@ -30,50 +31,24 @@ void saa1043_device::device_start() m_h = attotime::from_ticks(320, clock() * 2); m_line_count = s_line_counts[m_type]; - // resolve callbacks - for (uint32_t i = 0; i < OUT_COUNT; i++) - { - m_outputs[i].resolve_safe(); - if (m_outputs_hooked[i]) - { - m_timers[i] = timer_alloc(i); - switch(i) - { - case V2: - m_timers[V2]->adjust(m_h * 6, 1); - break; - default: - // Not yet implemented - break; - } - } - } + m_timers[OUT_V2] = timer_alloc(FUNC(saa1043_device::toggle_v2), this); + m_timers[OUT_V2]->adjust(m_h * 6, 1); } void saa1043_device::device_reset() { - // Clear any existing clock states for (uint32_t i = 0; i < OUT_COUNT; i++) { m_outputs[i](CLEAR_LINE); } - m_outputs[V2](ASSERT_LINE); + m_outputs[OUT_V2](ASSERT_LINE); } -void saa1043_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +TIMER_CALLBACK_MEMBER(saa1043_device::toggle_v2) { - switch (id) - { - case V2: - m_outputs[V2](1 - param); - if (param) - m_timers[V2]->adjust(m_h * (m_line_count - 9), 0); - else - m_timers[V2]->adjust(m_h * 9, 1); - break; - - default: - // Not yet implemented - break; - } + m_outputs[OUT_V2](1 - param); + if (param) + m_timers[OUT_V2]->adjust(m_h * (m_line_count - 9), 0); + else + m_timers[OUT_V2]->adjust(m_h * 9, 1); } |