summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author angelosa <salese_corp_ltd@email.it>2017-10-06 02:38:10 +0200
committer angelosa <salese_corp_ltd@email.it>2017-10-06 02:42:06 +0200
commita658d2de71bdf7f376510c76e8965ec70ea3ef73 (patch)
treef8015404356ac0f7ef0b3754caa35e768405c908
parent2d1d60bf756982995c69782f72d0b807059c821d (diff)
Improve previous commit (nw)
-rw-r--r--src/devices/machine/smpc.cpp18
-rw-r--r--src/devices/machine/smpc.h3
2 files changed, 9 insertions, 12 deletions
diff --git a/src/devices/machine/smpc.cpp b/src/devices/machine/smpc.cpp
index 042fbbc143e..85a49c5313b 100644
--- a/src/devices/machine/smpc.cpp
+++ b/src/devices/machine/smpc.cpp
@@ -205,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_mini_nvram(*this, "nvram"),
+ m_mini_nvram(*this, "smem"),
m_mshres(*this),
m_mshnmi(*this),
m_sshres(*this),
@@ -248,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_1FILL("nvram")
+ MCFG_NVRAM_ADD_0FILL("smem")
// TODO: custom RTC subdevice
MACHINE_CONFIG_END
@@ -262,7 +262,9 @@ void smpc_hle_device::device_start()
system_time systime;
machine().base_datetime(systime);
- m_mini_nvram->set_base(&m_smem, 4);
+// check if SMEM has valid data via byte 4 in the array, if not then simulate a battery backup fail
+// (-> call the RTC / Language select menu for Saturn)
+ m_mini_nvram->set_base(&m_smem, 5);
m_mshres.resolve_safe();
m_mshnmi.resolve_safe();
@@ -346,9 +348,6 @@ 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
@@ -656,9 +655,6 @@ 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;
@@ -669,6 +665,8 @@ void smpc_hle_device::device_timer(emu_timer &timer, device_timer_id id, int par
for(int i=0;i<4;i++)
m_smem[i] = m_ireg[i];
+ // clear the SETIME variable, simulate a cr2032 battery alive in the system
+ m_smem[4] = 0xff;
break;
}
@@ -716,7 +714,7 @@ void smpc_hle_device::resolve_intback()
if(m_intback_buf[0] != 0)
{
- m_oreg[0] = ((m_settime << 7) | ((m_NMI_reset & 1) << 6));
+ m_oreg[0] = ((m_smem[4] & 0x80) | ((m_NMI_reset & 1) << 6));
for(i=0;i<7;i++)
m_oreg[1+i] = m_rtc_data[i];
diff --git a/src/devices/machine/smpc.h b/src/devices/machine/smpc.h
index 62cc46ae9f0..99d857acff5 100644
--- a/src/devices/machine/smpc.h
+++ b/src/devices/machine/smpc.h
@@ -159,7 +159,7 @@ private:
uint8_t m_intback_buf[3];
uint8_t m_oreg[32];
uint8_t m_rtc_data[7];
- uint8_t m_smem[4];
+ uint8_t m_smem[5];
uint8_t m_comreg;
// in usec
// timing table, from manual in usec
@@ -180,7 +180,6 @@ private:
bool m_command_in_progress;
bool m_NMI_reset;
bool m_cur_dotsel;
- bool m_settime;
void master_sh2_nmi();
void irq_request();