diff options
author | angelosa <lordkale4@gmail.com> | 2022-11-04 21:14:57 +0100 |
---|---|---|
committer | angelosa <lordkale4@gmail.com> | 2022-11-04 21:14:57 +0100 |
commit | 00309d4a6c225db27a36369ea6349b0a32f0c38e (patch) | |
tree | e0a1c23d9b8dc7085f114590453edc80e7d15eb7 /src/devices/machine | |
parent | bcaed327ff988ed945507036c5290e71fe7b48f8 (diff) |
machine/rp5c01.cpp, seibu/banprestoms.cpp: add preliminary Sharp LH5045 RTC device
Diffstat (limited to 'src/devices/machine')
-rw-r--r-- | src/devices/machine/rp5c01.cpp | 22 | ||||
-rw-r--r-- | src/devices/machine/rp5c01.h | 16 |
2 files changed, 36 insertions, 2 deletions
diff --git a/src/devices/machine/rp5c01.cpp b/src/devices/machine/rp5c01.cpp index 8a59f07e9f8..2b1f99d1aae 100644 --- a/src/devices/machine/rp5c01.cpp +++ b/src/devices/machine/rp5c01.cpp @@ -13,6 +13,8 @@ - 12 hour clock - test register - timer reset + - convert I/O to address maps & views + - lh5045 doesn't really wrap time correctly */ @@ -23,6 +25,7 @@ // device type definitions DEFINE_DEVICE_TYPE(RP5C01, rp5c01_device, "rp5c01", "Ricoh RP5C01 RTC") DEFINE_DEVICE_TYPE(TC8521, tc8521_device, "tc8521", "Toshiba TC8521 RTC") +DEFINE_DEVICE_TYPE(LH5045, lh5045_device, "lh5045", "Sharp LH5045 RTC") //************************************************************************** @@ -432,3 +435,22 @@ tc8521_device::tc8521_device(const machine_config &mconfig, const char *tag, dev : rp5c01_device(mconfig, TC8521, tag, owner, clock) { } + +//------------------------------------------------- +// lh5045_device - constructor +//------------------------------------------------- + +lh5045_device::lh5045_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : rp5c01_device(mconfig, LH5045, tag, owner, clock) +{ +} + +TIMER_CALLBACK_MEMBER(lh5045_device::advance_1hz_clock) +{ + // inverted & different bit compared to rp5c01 + if (m_1hz && (!BIT(m_mode, 2))) + advance_seconds(); + + m_1hz = !m_1hz; + set_alarm_line(); +} diff --git a/src/devices/machine/rp5c01.h b/src/devices/machine/rp5c01.h index 7e48269b72c..511663b47c0 100644 --- a/src/devices/machine/rp5c01.h +++ b/src/devices/machine/rp5c01.h @@ -65,11 +65,11 @@ protected: virtual bool nvram_read(util::read_stream &file) override; virtual bool nvram_write(util::write_stream &file) override; - TIMER_CALLBACK_MEMBER(advance_1hz_clock); + virtual TIMER_CALLBACK_MEMBER(advance_1hz_clock); TIMER_CALLBACK_MEMBER(advance_16hz_clock); -private: inline void set_alarm_line(); +private: inline int read_counter(int counter); inline void write_counter(int counter, int value); inline void check_alarm(); @@ -77,6 +77,7 @@ private: devcb_write_line m_out_alarm_cb; bool m_battery_backed; +protected: uint8_t m_reg[2][13]; // clock registers uint8_t m_ram[13]; // RAM @@ -87,6 +88,7 @@ private: int m_1hz; // 1 Hz condition int m_16hz; // 16 Hz condition +private: // timers emu_timer *m_clock_timer; emu_timer *m_16hz_timer; @@ -101,9 +103,19 @@ public: tc8521_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; +class lh5045_device : public rp5c01_device +{ +public: + // construction/destruction + lh5045_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +private: + virtual TIMER_CALLBACK_MEMBER(advance_1hz_clock) override; +}; // device type definition DECLARE_DEVICE_TYPE(RP5C01, rp5c01_device) DECLARE_DEVICE_TYPE(TC8521, tc8521_device) +DECLARE_DEVICE_TYPE(LH5045, lh5045_device) #endif // MAME_MACHINE_RP5C01_H |