Hooked up MSM6242 device to Super Kaneko Nova System [Angelo Salese]

This commit is contained in:
Angelo Salese 2011-12-19 22:10:09 +00:00
parent f42ef7592a
commit 0600cd87ad
4 changed files with 17 additions and 58 deletions

View File

@ -2,9 +2,12 @@
MSM6242 Real Time Clock
Note:
- this RTC has a y2k bug
TODO:
- HOLD mechanism
- IRQ
- IRQ ACK
***************************************************************************/
@ -141,7 +144,7 @@ void msm6242_device::device_start()
m_rtc.day = (systime.local_time.mday);
m_rtc.month = (systime.local_time.month+1);
m_rtc.wday = (systime.local_time.weekday);
m_rtc.year = (systime.local_time.year)-1900;
m_rtc.year = (systime.local_time.year % 100);
m_rtc.hour = (systime.local_time.hour);
m_rtc.min = (systime.local_time.minute);
m_rtc.sec = (systime.local_time.second);
@ -233,7 +236,7 @@ READ8_MEMBER( msm6242_device::read )
case MSM6242_REG_MO1: return (cur_time .month % 10) & 0xf;
case MSM6242_REG_MO10: return (cur_time.month / 10) & 0xf;
case MSM6242_REG_Y1: return (cur_time.year % 10) & 0xf;
case MSM6242_REG_Y10: return ((cur_time.year % 100) / 10) & 0xf;
case MSM6242_REG_Y10: return ((cur_time.year / 10) % 10) & 0xf;
case MSM6242_REG_W: return cur_time.wday;
case MSM6242_REG_CD: return m_reg[0];
case MSM6242_REG_CE: return m_reg[1];

View File

@ -33,7 +33,8 @@ struct _msm6242_interface
typedef struct
{
UINT8 sec, min, hour, day, wday, month, year;
UINT8 sec, min, hour, day, wday, month;
UINT16 year;
} rtc_regs_t;

View File

@ -8979,6 +8979,7 @@ static TIMER_DEVICE_CALLBACK( inttoote_interrupt )
seta_state *state = timer.machine().driver_data<seta_state>();
int scanline = param;
/* ACIA irq */
if(scanline == 15)
device_set_input_line(state->m_maincpu, 4, HOLD_LINE);

View File

@ -150,6 +150,7 @@ NEP-16
#include "machine/nvram.h"
#include "video/sknsspr.h"
#include "includes/suprnova.h"
#include "machine/msm6242.h"
static void hit_calc_orig(UINT16 p, UINT16 s, UINT16 org, UINT16 *l, UINT16 *r)
{
@ -602,18 +603,6 @@ INPUT_PORTS_END
static WRITE32_HANDLER( skns_msm6242_w )
{
skns_state *state = space->machine().driver_data<skns_state>();
COMBINE_DATA(&state->m_timer_0_temp[offset]);
if(offset>=4)
{
mame_printf_debug("Timer 0 outbound\n");
return;
}
}
static WRITE32_HANDLER( skns_io_w )
{
switch(offset) {
@ -675,46 +664,6 @@ static WRITE32_HANDLER( skns_io_w )
}
}
static READ32_HANDLER( skns_msm6242_r )
{
system_time systime;
long value;
space->machine().base_datetime(systime);
// The clock is not y2k-compatible, wrap back 10 years, screw the leap years
// tm->tm_year -= 10;
switch(offset) {
case 0:
value = (systime.local_time.second % 10)<<24;
value |= (systime.local_time.second / 10)<<16;
value |= (systime.local_time.minute % 10)<<8;
value |= (systime.local_time.minute / 10);
break;
case 1:
value = (systime.local_time.hour % 10)<<24;
value |= ((systime.local_time.hour / 10) /*| (tm->tm_hour >= 12 ? 4 : 0)*/)<<16;
value |= (systime.local_time.mday % 10)<<8;
value |= (systime.local_time.mday / 10);
break;
case 2:
value = ((systime.local_time.month + 1) % 10)<<24;
value |= ((systime.local_time.month + 1) / 10)<<16;
value |= (systime.local_time.year % 10)<<8;
value |= ((systime.local_time.year / 10) % 10);
break;
case 3:
default:
value = (systime.local_time.weekday)<<24;
value |= (1)<<16;
value |= (6)<<8;
value |= (4);
break;
}
return value;
}
/* end old driver code */
static WRITE32_HANDLER( skns_v3t_w )
@ -744,7 +693,7 @@ static ADDRESS_MAP_START( skns_map, AS_PROGRAM, 32 )
AM_RANGE(0x0040000c, 0x0040000f) AM_READ_PORT("40000c")
AM_RANGE(0x00800000, 0x00801fff) AM_RAM AM_SHARE("nvram") /* 'backup' RAM */
AM_RANGE(0x00c00000, 0x00c00003) AM_DEVREADWRITE8("ymz", ymz280b_r, ymz280b_w, 0xffff0000) /* ymz280_w (sound) */
AM_RANGE(0x01000000, 0x0100000f) AM_READWRITE(skns_msm6242_r, skns_msm6242_w)
AM_RANGE(0x01000000, 0x0100000f) AM_DEVREADWRITE8_MODERN("rtc", msm6242_device, read, write, 0xffffffff)
AM_RANGE(0x01800000, 0x01800003) AM_WRITE(skns_hit2_w)
AM_RANGE(0x02000000, 0x02003fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) /* sprite ram */
AM_RANGE(0x02100000, 0x0210003f) AM_RAM AM_BASE_MEMBER(skns_state, m_spc_regs) /* sprite registers */
@ -805,13 +754,18 @@ static const ymz280b_interface ymz280b_intf =
};
static MSM6242_INTERFACE( rtc_intf )
{
DEVCB_NULL
};
static MACHINE_CONFIG_START( skns, skns_state )
MCFG_CPU_ADD("maincpu", SH2,28638000)
MCFG_CPU_PROGRAM_MAP(skns_map)
MCFG_TIMER_ADD_SCANLINE("scantimer", skns_irq, "screen", 0, 1)
MCFG_MSM6242_ADD("rtc", rtc_intf)
MCFG_MACHINE_RESET(skns)
MCFG_NVRAM_ADD_1FILL("nvram")