summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/cpc/smartwatch.cpp
diff options
context:
space:
mode:
author Patrick Mackinlay <pmackinlay@hotmail.com>2025-01-02 12:30:59 +0700
committer Patrick Mackinlay <pmackinlay@hotmail.com>2025-01-02 12:32:32 +0700
commit2da636bb214ee65c339b385ffc3be275d06ff76e (patch)
tree02fccfdded5689b089e0f3cb711debd6cc1f1386 /src/devices/bus/cpc/smartwatch.cpp
parentab34107f9f6487444682837e106edaed0c35c491 (diff)
ds1215: modernize and complete emulation
* rename previous ds1315 to earlier/original ds1215 device * support both ds1215 and transparent access methods * implement rtc and nvram interfaces * support updating registers
Diffstat (limited to 'src/devices/bus/cpc/smartwatch.cpp')
-rw-r--r--src/devices/bus/cpc/smartwatch.cpp31
1 files changed, 9 insertions, 22 deletions
diff --git a/src/devices/bus/cpc/smartwatch.cpp b/src/devices/bus/cpc/smartwatch.cpp
index a58b30f2c0a..4b2aa04cd10 100644
--- a/src/devices/bus/cpc/smartwatch.cpp
+++ b/src/devices/bus/cpc/smartwatch.cpp
@@ -4,9 +4,6 @@
Dobbertin Smartwatch
Created: 23/2/2015
-
- TODO: setting the time (requires the DS1315 core to be able to do this,
- at the moment it just reads the current time)
*/
#include "emu.h"
@@ -21,8 +18,7 @@ DEFINE_DEVICE_TYPE(CPC_SMARTWATCH, cpc_smartwatch_device, "cpc_smartwatch", "Dob
void cpc_smartwatch_device::device_add_mconfig(machine_config &config)
{
- DS1315(config, m_rtc, 0);
- // no pass-through (?)
+ DS1216E(config, m_rtc);
}
@@ -63,26 +59,17 @@ void cpc_smartwatch_device::device_start()
void cpc_smartwatch_device::device_reset()
{
address_space &space = m_slot->cpu().space(AS_PROGRAM);
- space.install_read_handler(0xc000,0xc001, read8sm_delegate(*this, FUNC(cpc_smartwatch_device::rtc_w)));
- space.install_read_handler(0xc004,0xc004, read8smo_delegate(*this, FUNC(cpc_smartwatch_device::rtc_r)));
+ // FIXME: should cover the whole ROM address decode range
+ space.install_read_handler(0xc000,0xc004, read8sm_delegate(*this, FUNC(cpc_smartwatch_device::rtc_r)));
m_bank = membank(":bank7");
}
-uint8_t cpc_smartwatch_device::rtc_w(offs_t offset)
-{
- uint8_t* bank = (uint8_t*)m_bank->base();
- if (!machine().side_effects_disabled())
- {
- if(offset & 1)
- m_rtc->read_1();
- else
- m_rtc->read_0();
- }
- return bank[offset & 1];
-}
-
-uint8_t cpc_smartwatch_device::rtc_r()
+uint8_t cpc_smartwatch_device::rtc_r(offs_t offset)
{
uint8_t* bank = (uint8_t*)m_bank->base();
- return (bank[4] & 0xfe) | (m_rtc->read_data() & 0x01);
+ if (m_rtc->ceo_r())
+ return m_rtc->read(offset);
+ else
+ m_rtc->read(offset);
+ return bank[offset];
}