From 324e79adc92ea6bb3e0a4f5c5ded99188d13ece2 Mon Sep 17 00:00:00 2001 From: AJR Date: Sat, 4 Jun 2022 16:25:10 -0400 Subject: [PATCH] mc6805: Timer updates - Allow timer prescaler and mode to be determined by configuration parameters on models for which these are not otherwise programmable (P2, P6, R2 and U2 models) - Change default value of timer input from 0 to 1 --- src/devices/cpu/m6805/m68705.cpp | 10 +++++++++- src/devices/cpu/m6805/m68705.h | 18 +++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/devices/cpu/m6805/m68705.cpp b/src/devices/cpu/m6805/m68705.cpp index 845d46bb31f..96a36d2c711 100644 --- a/src/devices/cpu/m6805/m68705.cpp +++ b/src/devices/cpu/m6805/m68705.cpp @@ -809,7 +809,8 @@ m6805p2_device::m6805p2_device(machine_config const &mconfig, char const *tag, d * support prescalar clear, however the 1988 databook indicates the * M6805P2 does? */ - //m_timer.set_options(m6805_timer::TIMER_NPC); + m_timer.set_options(m6805_timer::TIMER_MOR /* | m6805::TIMER_NPC */); + m_timer.set_source(m6805_timer::CLOCK_TIMER); set_port_mask<2>(0xf0); // Port C is four bits wide set_port_mask<3>(0xff); // Port D isn't present @@ -818,6 +819,9 @@ m6805p2_device::m6805p2_device(machine_config const &mconfig, char const *tag, d m6805p6_device::m6805p6_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock) : m6805_mrom_device(mconfig, tag, owner, clock, M6805P6, 11, 64) { + m_timer.set_options(m6805_timer::TIMER_MOR /* | m6805::TIMER_NPC */); + m_timer.set_source(m6805_timer::CLOCK_TIMER); + set_port_mask<2>(0xf0); // Port C is four bits wide set_port_mask<3>(0xff); // Port D isn't present } @@ -825,6 +829,8 @@ m6805p6_device::m6805p6_device(machine_config const &mconfig, char const *tag, d m6805r2_device::m6805r2_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock) : m6805_mrom_device(mconfig, tag, owner, clock, M6805R2, 12, 64) { + m_timer.set_options(m6805_timer::TIMER_MOR); + m_timer.set_source(m6805_timer::CLOCK_TIMER); } m6805r3_device::m6805r3_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock) @@ -836,6 +842,8 @@ m6805r3_device::m6805r3_device(machine_config const &mconfig, char const *tag, d m6805u2_device::m6805u2_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock) : m6805_mrom_device(mconfig, tag, owner, clock, M6805U2, 12, 64) { + m_timer.set_options(m6805_timer::TIMER_MOR); + m_timer.set_source(m6805_timer::CLOCK_TIMER); } m6805u3_device::m6805u3_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock) diff --git a/src/devices/cpu/m6805/m68705.h b/src/devices/cpu/m6805/m68705.h index 919a47f71ed..e8bd0659135 100644 --- a/src/devices/cpu/m6805/m68705.h +++ b/src/devices/cpu/m6805/m68705.h @@ -48,7 +48,7 @@ public: , m_options(0) , m_divisor(7) , m_source(CLOCK) - , m_timer(false) + , m_timer(true) { } @@ -335,12 +335,20 @@ class m6805p2_device : public m6805_mrom_device { public: m6805p2_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); + + // mask options + void set_timer_divisor(unsigned divisor) { m_timer.set_divisor(divisor); } + void set_timer_external_source(bool external) { m_timer.set_source(external ? m6805_timer::TIMER : m6805_timer::CLOCK_TIMER); } }; class m6805p6_device : public m6805_mrom_device { public: m6805p6_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); + + // mask options + void set_timer_divisor(unsigned divisor) { m_timer.set_divisor(divisor); } + void set_timer_external_source(bool external) { m_timer.set_source(external ? m6805_timer::TIMER : m6805_timer::CLOCK_TIMER); } }; class m6805r2_device : public m6805_mrom_device @@ -348,6 +356,10 @@ class m6805r2_device : public m6805_mrom_device public: m6805r2_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); + // mask options + void set_timer_divisor(unsigned divisor) { m_timer.set_divisor(divisor); } + void set_timer_external_source(bool external) { m_timer.set_source(external ? m6805_timer::TIMER : m6805_timer::CLOCK_TIMER); } + protected: virtual void internal_map(address_map &map) override; }; @@ -365,6 +377,10 @@ class m6805u2_device : public m6805_mrom_device { public: m6805u2_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); + + // mask options + void set_timer_divisor(unsigned divisor) { m_timer.set_divisor(divisor); } + void set_timer_external_source(bool external) { m_timer.set_source(external ? m6805_timer::TIMER : m6805_timer::CLOCK_TIMER); } }; class m6805u3_device : public m6805_mrom_device