summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/machine/msm6242.c
diff options
context:
space:
mode:
author Nathan Woods <npwoods@mess.org>2012-12-10 11:32:53 +0000
committer Nathan Woods <npwoods@mess.org>2012-12-10 11:32:53 +0000
commite8170f94d67e223224df7f88bdf4917784d3e49b (patch)
treeec9fdc4322fc1a3ab40a28c44d7dd218569bf88d /src/emu/machine/msm6242.c
parent10e73ffbdb703926a2671d856f1a451e1b7d05ff (diff)
[MSM6242] More cleanups (nw), implemented save states
Diffstat (limited to 'src/emu/machine/msm6242.c')
-rw-r--r--src/emu/machine/msm6242.c74
1 files changed, 28 insertions, 46 deletions
diff --git a/src/emu/machine/msm6242.c b/src/emu/machine/msm6242.c
index f7317d7275d..0c74b57ee2c 100644
--- a/src/emu/machine/msm6242.c
+++ b/src/emu/machine/msm6242.c
@@ -80,8 +80,8 @@ void msm6242_device::rtc_timer_callback()
if(m_irq_flag == 1 && m_irq_type == 0 && ((m_tick % 0x200) == 0)) // 1/64 of second
{
- if ( !m_out_int_func.isnull() )
- m_out_int_func( ASSERT_LINE );
+ if ( !m_res_out_int_func.isnull() )
+ m_res_out_int_func( ASSERT_LINE );
}
if(m_tick & 0x8000) // 32,768 KHz == 0x8000 ticks
@@ -90,22 +90,22 @@ void msm6242_device::rtc_timer_callback()
m_rtc.sec++;
if(m_irq_flag == 1 && m_irq_type == 1) // 1 second clock
- if ( !m_out_int_func.isnull() )
- m_out_int_func(ASSERT_LINE);
+ if ( !m_res_out_int_func.isnull() )
+ m_res_out_int_func(ASSERT_LINE);
if(m_rtc.sec >= 60)
{
m_rtc.min++; m_rtc.sec = 0;
if(m_irq_flag == 1 && m_irq_type == 2) // 1 minute clock
- if ( !m_out_int_func.isnull() )
- m_out_int_func(ASSERT_LINE);
+ if ( !m_res_out_int_func.isnull() )
+ m_res_out_int_func(ASSERT_LINE);
}
if(m_rtc.min >= 60)
{
m_rtc.hour++; m_rtc.min = 0;
if(m_irq_flag == 1 && m_irq_type == 3) // 1 hour clock
- if ( !m_out_int_func.isnull() )
- m_out_int_func(ASSERT_LINE);
+ if ( !m_res_out_int_func.isnull() )
+ m_res_out_int_func(ASSERT_LINE);
}
if(m_rtc.hour >= 24) { m_rtc.day++; m_rtc.wday++; m_rtc.hour = 0; }
if(m_rtc.wday >= 6) { m_rtc.wday = 1; }
@@ -143,23 +143,14 @@ void msm6242_device::device_timer(emu_timer &timer, device_timer_id id, int para
//-------------------------------------------------
-// device_validity_check - perform validity checks
-// on this device
-//-------------------------------------------------
-
-void msm6242_device::device_validity_check(validity_checker &valid) const
-{
-}
-
-
-
-//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void msm6242_device::device_start()
{
- m_out_int_func.resolve( m_out_int_cb, *this );
+ const msm6242_interface *intf = reinterpret_cast<const msm6242_interface *>(static_config());
+ if (intf != NULL)
+ m_res_out_int_func.resolve(intf->m_out_int_func, *this);
// let's call the timer callback every tick
m_timer = timer_alloc(TIMER_RTC_CALLBACK);
@@ -185,6 +176,19 @@ void msm6242_device::device_start()
m_reg[0] = 0;
m_reg[1] = 0x6;
m_reg[2] = 0x4;
+
+ // save states
+ save_item(NAME(m_reg));
+ save_item(NAME(m_irq_flag));
+ save_item(NAME(m_irq_type));
+ save_item(NAME(m_tick));
+ save_item(NAME(m_rtc.sec));
+ save_item(NAME(m_rtc.min));
+ save_item(NAME(m_rtc.hour));
+ save_item(NAME(m_rtc.wday));
+ save_item(NAME(m_rtc.day));
+ save_item(NAME(m_rtc.month));
+ save_item(NAME(m_rtc.year));
}
@@ -195,30 +199,8 @@ void msm6242_device::device_start()
void msm6242_device::device_reset()
{
- if ( !m_out_int_func.isnull() )
- m_out_int_func( CLEAR_LINE );
-}
-
-
-
-//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void msm6242_device::device_config_complete()
-{
- const msm6242_interface *intf = reinterpret_cast<const msm6242_interface *>(static_config());
-
- if ( intf != NULL )
- {
- m_out_int_cb = intf->m_out_int_cb;
- }
- else
- {
- memset(&m_out_int_cb, 0, sizeof(m_out_int_cb));
- }
+ if ( !m_res_out_int_func.isnull() )
+ m_res_out_int_func( CLEAR_LINE );
}
@@ -320,8 +302,8 @@ WRITE8_MEMBER( msm6242_device::write )
else
{
m_irq_flag = 0;
- if ( !m_out_int_func.isnull() )
- m_out_int_func( CLEAR_LINE );
+ if ( !m_res_out_int_func.isnull() )
+ m_res_out_int_func( CLEAR_LINE );
}
return;