diff options
Diffstat (limited to 'src/devices/machine/smpc.cpp')
-rw-r--r-- | src/devices/machine/smpc.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/devices/machine/smpc.cpp b/src/devices/machine/smpc.cpp index aa8ef073dbb..042fbbc143e 100644 --- a/src/devices/machine/smpc.cpp +++ b/src/devices/machine/smpc.cpp @@ -14,7 +14,8 @@ TODO: - fix intback issue with inputs (according to the docs, it should fall in between VBLANK-IN and OUT, for obvious reasons); - clean-ups; -- RTC device (unknown type, handled here for convenience) +- RTC subdevice (unknown type, handled here for convenience); +- Does ST-V even has a battery backed NVRAM? Notes: SMPC NVRAM contents: @@ -204,7 +205,7 @@ smpc_hle_device::smpc_hle_device(const machine_config &mconfig, const char *tag, : device_t(mconfig, SMPC_HLE, tag, owner, clock), device_memory_interface(mconfig, *this), m_space_config("regs", ENDIANNESS_LITTLE, 8, 7, 0, nullptr, *ADDRESS_MAP_NAME(smpc_regs)), - m_smpc_nv(*this, "smpc_nv"), + m_mini_nvram(*this, "nvram"), m_mshres(*this), m_mshnmi(*this), m_sshres(*this), @@ -247,7 +248,7 @@ void smpc_hle_device::static_set_control_port_tags(device_t &device, const char //------------------------------------------------- MACHINE_CONFIG_MEMBER(smpc_hle_device::device_add_mconfig) - MCFG_NVRAM_ADD_0FILL("smpc_nv") // TODO: default for each region (+ move it inside SMPC when converted to device) + MCFG_NVRAM_ADD_1FILL("nvram") // TODO: custom RTC subdevice MACHINE_CONFIG_END @@ -261,8 +262,8 @@ void smpc_hle_device::device_start() system_time systime; machine().base_datetime(systime); - m_smpc_nv->set_base(&m_smem, 4); - + m_mini_nvram->set_base(&m_smem, 4); + m_mshres.resolve_safe(); m_mshnmi.resolve_safe(); m_sshres.resolve_safe(); @@ -345,6 +346,9 @@ void smpc_hle_device::device_reset() m_cur_dotsel = false; m_rtc_timer->adjust(attotime::zero, 0, attotime::from_seconds(1)); + +// check if SMEM has valid data (default 1 filled), if not then simulate a battery backup fail (-> call the RTC / Language select menu for Saturn) + m_settime = m_smem[0] != 0xff; } device_memory_interface::space_config_vector smpc_hle_device::memory_space_config() const @@ -504,11 +508,6 @@ uint8_t smpc_hle_device::get_ddr(bool which) } -inline bool smpc_hle_device::get_nmi_status() -{ - return m_NMI_reset; -} - inline void smpc_hle_device::master_sh2_nmi() { m_mshnmi(1); @@ -657,6 +656,9 @@ void smpc_hle_device::device_timer(emu_timer &timer, device_timer_id id, int par case 0x16: // SETTIME { + // setting this up will clear the set time in case of battery backed died + m_settime = true; + for(int i=0;i<7;i++) m_rtc_data[i] = m_ireg[i]; break; @@ -714,8 +716,8 @@ void smpc_hle_device::resolve_intback() if(m_intback_buf[0] != 0) { - m_oreg[0] = ((0x80) | ((m_NMI_reset & 1) << 6)); - + m_oreg[0] = ((m_settime << 7) | ((m_NMI_reset & 1) << 6)); + for(i=0;i<7;i++) m_oreg[1+i] = m_rtc_data[i]; |