summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author angelosa <salese_corp_ltd@email.it>2017-10-05 06:15:16 +0200
committer angelosa <salese_corp_ltd@email.it>2017-10-05 06:16:03 +0200
commit5d6fcb0d8df089ec363fbf1c25424f541aedf59f (patch)
tree6bffc5690a9fb148359e031a894c5fba33e91b31
parent9628bda4fb8b1482293f0cc9b5ddea328c63da31 (diff)
smpc.cpp: simulate SETTIME bit behaviour if an invalid NVRAM data is found for Sega Saturn like original HW does. [Angelo Salese]
* Now all Sega Saturn romsets calls the BIOS setup if NVRAM is uninitialized. This is intended behaviour and sets up proper defaults like Japanese language for saturnjp set.
-rw-r--r--src/devices/machine/smpc.cpp26
-rw-r--r--src/devices/machine/smpc.h4
-rw-r--r--src/mame/drivers/stv.cpp4
3 files changed, 18 insertions, 16 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];
diff --git a/src/devices/machine/smpc.h b/src/devices/machine/smpc.h
index d86e40b431e..62cc46ae9f0 100644
--- a/src/devices/machine/smpc.h
+++ b/src/devices/machine/smpc.h
@@ -180,10 +180,10 @@ private:
bool m_command_in_progress;
bool m_NMI_reset;
bool m_cur_dotsel;
+ bool m_settime;
void master_sh2_nmi();
void irq_request();
- bool get_nmi_status();
void resolve_intback();
void intback_continue_request();
@@ -199,7 +199,7 @@ private:
int m_pmode;
uint8_t m_region_code;
- required_device<nvram_device> m_smpc_nv;
+ required_device<nvram_device> m_mini_nvram;
devcb_write_line m_mshres;
devcb_write_line m_mshnmi;
devcb_write_line m_sshres;
diff --git a/src/mame/drivers/stv.cpp b/src/mame/drivers/stv.cpp
index 222087da8a0..556e995bfba 100644
--- a/src/mame/drivers/stv.cpp
+++ b/src/mame/drivers/stv.cpp
@@ -1353,8 +1353,8 @@ static INPUT_PORTS_START( stv )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("1P Push Switch") PORT_CODE(KEYCODE_7)
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("2P Push Switch") PORT_CODE(KEYCODE_8)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("1P Push Switch (Multi Cart Select)") PORT_CODE(KEYCODE_7) // selects game in multi-cart mode
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("2P Push Switch (Pause)") PORT_CODE(KEYCODE_8) // for games that supports it, most of them needs to be enabled in game assignment first
PORT_START("PORTE")
STV_PLAYER_INPUTS(3, BUTTON1, BUTTON2, BUTTON3, START)