diff --git a/src/devices/machine/ds1386.h b/src/devices/machine/ds1386.h index 72740b7eedafd..c7b15d1679965 100644 --- a/src/devices/machine/ds1386.h +++ b/src/devices/machine/ds1386.h @@ -166,8 +166,6 @@ class ds1386_device : public device_t, void safe_intb_cb(int state); void safe_sqw_cb(int state); - void set_current_time(); - void check_tod_alarm(); void time_of_day_alarm(); void watchdog_alarm(); diff --git a/src/devices/machine/rp5c15.cpp b/src/devices/machine/rp5c15.cpp index 75481d24f7fd7..f2b8ff4a03777 100644 --- a/src/devices/machine/rp5c15.cpp +++ b/src/devices/machine/rp5c15.cpp @@ -109,6 +109,14 @@ enum DEFINE_DEVICE_TYPE(RP5C15, rp5c15_device, "rp5c15", "Ricoh RP5C15 RTC") +// x68k wants an epoch base (1980-2079) on init, mz2500 do not ("print date$" under basicv2) +// megast_* tbd +void rp5c15_device::set_current_time(const system_time &systime) +{ + const system_time::full_time &time = m_use_utc ? systime.utc_time : systime.local_time; + set_time(true, time.year + m_year_offset, time.month + 1, time.mday, time.weekday + 1, + time.hour, time.minute, time.second); +} //************************************************************************** // INLINE HELPERS diff --git a/src/devices/machine/rp5c15.h b/src/devices/machine/rp5c15.h index 15936a0244520..6630260fc8cad 100644 --- a/src/devices/machine/rp5c15.h +++ b/src/devices/machine/rp5c15.h @@ -34,10 +34,13 @@ class rp5c15_device : public device_t, auto alarm() { return m_out_alarm_cb.bind(); } auto clkout() { return m_out_clkout_cb.bind(); } + void set_year_offset(int year) { m_year_offset = year; } uint8_t read(offs_t offset); void write(offs_t offset, uint8_t data); + virtual void set_current_time(const system_time &systime) override; + protected: // device-level overrides virtual void device_start() override; @@ -70,6 +73,8 @@ class rp5c15_device : public device_t, int m_16hz; // 16 Hz condition int m_clkout; // clock output + int m_year_offset = 0; + // timers emu_timer *m_clock_timer; emu_timer *m_16hz_timer; diff --git a/src/emu/dirtc.h b/src/emu/dirtc.h index e76a8d3dba300..e741cfc262834 100644 --- a/src/emu/dirtc.h +++ b/src/emu/dirtc.h @@ -51,7 +51,7 @@ class device_rtc_interface : public device_interface void set_use_utc(bool use_utc) { m_use_utc = use_utc; } void set_time(bool update, int year, int month, int day, int day_of_week, int hour, int minute, int second); - void set_current_time(const system_time &systime); + virtual void set_current_time(const system_time &systime); bool has_battery() const { return rtc_battery_backed(); } diff --git a/src/mame/sharp/x68k.cpp b/src/mame/sharp/x68k.cpp index 45fa1b582f5b3..7565356a2ce44 100644 --- a/src/mame/sharp/x68k.cpp +++ b/src/mame/sharp/x68k.cpp @@ -1282,6 +1282,7 @@ void x68k_state::x68000_base(machine_config &config) RP5C15(config, m_rtc, 32.768_kHz_XTAL); m_rtc->alarm().set(m_mfpdev, FUNC(mc68901_device::i0_w)); + m_rtc->set_year_offset(20); /* video hardware */ SCREEN(config, m_screen, SCREEN_TYPE_RASTER);