ggconnie RTC is a MSM6242

This commit is contained in:
Angelo Salese 2013-01-15 20:17:22 +00:00
parent 14a48037d7
commit 1b704e28ba

View File

@ -24,6 +24,7 @@
#include "cpu/h6280/h6280.h"
#include "sound/c6280.h"
#include "sound/okim6295.h"
#include "machine/msm6242.h"
class ggconnie_state : public pce_common_state
@ -32,10 +33,12 @@ public:
ggconnie_state(const machine_config &mconfig, device_type type, const char *tag)
: pce_common_state(mconfig, type, tag),
m_huc6260(*this, "huc6260"),
m_rtc(*this, "rtc"),
m_oki(*this, "oki")
{ }
required_device <huc6260_device> m_huc6260;
required_device <msm6242_device> m_rtc;
required_device <okim6295_device> m_oki;
DECLARE_WRITE8_MEMBER(lamp_w);
DECLARE_WRITE8_MEMBER(output_w);
@ -47,6 +50,56 @@ public:
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
};
UINT32 ggconnie_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_huc6260->video_update( bitmap, cliprect );
return 0;
}
WRITE8_MEMBER(ggconnie_state::lamp_w)
{
output_set_value("lamp", !BIT(data,0));
}
WRITE8_MEMBER(ggconnie_state::output_w)
{
// written in "Output Test" in test mode
}
/* TODO: banking not understood (is the ROM dumped correctly btw?) */
WRITE8_MEMBER(ggconnie_state::oki_bank_w)
{
m_oki->set_bank_base((data) ? 0x40000 : 0x00000);
}
static ADDRESS_MAP_START( sgx_mem , AS_PROGRAM, 8, ggconnie_state )
AM_RANGE( 0x000000, 0x0fffff) AM_ROM
AM_RANGE( 0x110000, 0x1edfff) AM_NOP
AM_RANGE( 0x1ee800, 0x1effff) AM_NOP
AM_RANGE( 0x1f0000, 0x1f5fff) AM_RAM
AM_RANGE( 0x1f7000, 0x1f7000) AM_READ_PORT("SWA")
AM_RANGE( 0x1f7100, 0x1f7100) AM_READ_PORT("SWB")
AM_RANGE( 0x1f7200, 0x1f7200) AM_READ_PORT("SWC")
AM_RANGE( 0x1f7700, 0x1f7700) AM_READ_PORT("IN1")
AM_RANGE( 0x1f7800, 0x1f7800) AM_WRITE(output_w)
AM_RANGE( 0x1fe000, 0x1fe007) AM_DEVREADWRITE( "huc6270_0", huc6270_device, read, write ) AM_MIRROR(0x03E0)
AM_RANGE( 0x1fe008, 0x1fe00f) AM_DEVREADWRITE( "huc6202", huc6202_device, read, write ) AM_MIRROR(0x03E0)
AM_RANGE( 0x1fe010, 0x1fe017) AM_DEVREADWRITE( "huc6270_1", huc6270_device, read, write ) AM_MIRROR(0x03E0)
AM_RANGE( 0x1fe400, 0x1fe7ff) AM_DEVREADWRITE( "huc6260", huc6260_device, read, write )
AM_RANGE( 0x1fe800, 0x1febff) AM_DEVREADWRITE("c6280", c6280_device, c6280_r, c6280_w)
AM_RANGE( 0x1fec00, 0x1fefff) AM_DEVREADWRITE("maincpu", h6280_device, timer_r, timer_w)
AM_RANGE( 0x1f7300, 0x1f7300) AM_DEVREADWRITE("oki", okim6295_device, read, write)
AM_RANGE( 0x1f7400, 0x1f74ff) AM_WRITE(oki_bank_w)
AM_RANGE( 0x1f7500, 0x1f750f) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
AM_RANGE( 0x1ff000, 0x1ff000) AM_READ_PORT("IN0") AM_WRITE(lamp_w)
AM_RANGE( 0x1ff400, 0x1ff7ff) AM_DEVREADWRITE("maincpu", h6280_device, irq_status_r, irq_status_w )
ADDRESS_MAP_END
static ADDRESS_MAP_START( sgx_io , AS_IO, 8, ggconnie_state )
AM_RANGE( 0x00, 0x03) AM_DEVREADWRITE( "huc6202", huc6202_device, io_read, io_write )
ADDRESS_MAP_END
static INPUT_PORTS_START(ggconnie)
PORT_START("IN0")
@ -125,95 +178,14 @@ static INPUT_PORTS_START(ggconnie)
PORT_DIPNAME(0x40, 0x00, "RAM Clear" ) PORT_DIPLOCATION("SWC:7")
PORT_DIPSETTING(0x40, DEF_STR(Off) )
PORT_DIPSETTING(0x00, DEF_STR(On) )
PORT_SERVICE(0x80, IP_ACTIVE_LOW) PORT_DIPLOCATION("SWC:8")
PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_LOW) PORT_DIPLOCATION("SWC:8")
INPUT_PORTS_END
WRITE8_MEMBER(ggconnie_state::lamp_w)
{
output_set_value("lamp", !BIT(data,0));
}
WRITE8_MEMBER(ggconnie_state::output_w)
{
// written in "Output Test" in test mode
}
/* TODO: unknown type */
READ8_MEMBER(ggconnie_state::rtc_r)
{
system_time systime;
machine().base_datetime(systime);
switch(offset)
{
case 0x00: return (systime.local_time.second % 10) & 0xf;
case 0x01: return (systime.local_time.second / 10) & 0xf;
case 0x02: return (systime.local_time.minute % 10) & 0xf;
case 0x03: return (systime.local_time.minute / 10) & 0xf;
case 0x04: return (systime.local_time.hour % 10) & 0xf;
case 0x05: return (systime.local_time.hour / 10) & 0xf;
case 0x07: return ((systime.local_time.day+1) % 10) & 0xf;
case 0x08: return ((systime.local_time.day+1) / 10) & 0xf;
case 0x09: return ((systime.local_time.month+1) % 10) & 0xf;
case 0x0a: return ((systime.local_time.month+1) / 10) & 0xf;
case 0x0b: return ((systime.local_time.year-1996) % 10) & 0xf;
case 0x0c: return (((systime.local_time.year-1996) % 100) / 10) & 0xf;
}
return 0;
}
WRITE8_MEMBER(ggconnie_state::rtc_w)
{
}
/* TODO: banking not understood (is the ROM dumped correctly btw?) */
WRITE8_MEMBER(ggconnie_state::oki_bank_w)
{
m_oki->set_bank_base((data) ? 0x40000 : 0x00000);
}
static ADDRESS_MAP_START( sgx_mem , AS_PROGRAM, 8, ggconnie_state )
AM_RANGE( 0x000000, 0x0fffff) AM_ROM
AM_RANGE( 0x110000, 0x1edfff) AM_NOP
AM_RANGE( 0x1ee800, 0x1effff) AM_NOP
AM_RANGE( 0x1f0000, 0x1f5fff) AM_RAM
AM_RANGE( 0x1f7000, 0x1f7000) AM_READ_PORT("SWA")
AM_RANGE( 0x1f7100, 0x1f7100) AM_READ_PORT("SWB")
AM_RANGE( 0x1f7200, 0x1f7200) AM_READ_PORT("SWC")
AM_RANGE( 0x1f7700, 0x1f7700) AM_READ_PORT("IN1")
AM_RANGE( 0x1f7800, 0x1f7800) AM_WRITE(output_w)
AM_RANGE( 0x1fe000, 0x1fe007) AM_DEVREADWRITE( "huc6270_0", huc6270_device, read, write ) AM_MIRROR(0x03E0)
AM_RANGE( 0x1fe008, 0x1fe00f) AM_DEVREADWRITE( "huc6202", huc6202_device, read, write ) AM_MIRROR(0x03E0)
AM_RANGE( 0x1fe010, 0x1fe017) AM_DEVREADWRITE( "huc6270_1", huc6270_device, read, write ) AM_MIRROR(0x03E0)
AM_RANGE( 0x1fe400, 0x1fe7ff) AM_DEVREADWRITE( "huc6260", huc6260_device, read, write )
AM_RANGE( 0x1fe800, 0x1febff) AM_DEVREADWRITE("c6280", c6280_device, c6280_r, c6280_w)
AM_RANGE( 0x1fec00, 0x1fefff) AM_DEVREADWRITE("maincpu", h6280_device, timer_r, timer_w)
AM_RANGE( 0x1f7300, 0x1f7300) AM_DEVREADWRITE("oki", okim6295_device, read, write)
AM_RANGE( 0x1f7400, 0x1f74ff) AM_WRITE(oki_bank_w)
AM_RANGE( 0x1f7500, 0x1f750f) AM_READWRITE(rtc_r,rtc_w)
AM_RANGE( 0x1ff000, 0x1ff000) AM_READ_PORT("IN0") AM_WRITE(lamp_w)
AM_RANGE( 0x1ff400, 0x1ff7ff) AM_DEVREADWRITE("maincpu", h6280_device, irq_status_r, irq_status_w )
ADDRESS_MAP_END
static ADDRESS_MAP_START( sgx_io , AS_IO, 8, ggconnie_state )
AM_RANGE( 0x00, 0x03) AM_DEVREADWRITE( "huc6202", huc6202_device, io_read, io_write )
ADDRESS_MAP_END
static const c6280_interface c6280_config =
{
"maincpu"
};
UINT32 ggconnie_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_huc6260->video_update( bitmap, cliprect );
return 0;
}
WRITE_LINE_MEMBER(ggconnie_state::pce_irq_changed)
{
machine().device("maincpu")->execute().set_input_line(0, state);
@ -277,6 +249,11 @@ static const huc6260_interface sgx_huc6260_config =
DEVCB_DEVICE_LINE_MEMBER( "huc6202", huc6202_device, hsync_changed )
};
static MSM6242_INTERFACE( ggconnie_rtc_intf )
{
DEVCB_NULL
};
static MACHINE_CONFIG_START( ggconnie, ggconnie_state )
/* basic machine hardware */
@ -284,8 +261,6 @@ static MACHINE_CONFIG_START( ggconnie, ggconnie_state )
MCFG_CPU_PROGRAM_MAP(sgx_mem)
MCFG_CPU_IO_MAP(sgx_io)
// MCFG_QUANTUM_TIME(attotime::from_hz(60))
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(PCE_MAIN_CLOCK/3, HUC6260_WPF, 64, 64 + 1024 + 64, HUC6260_LPF, 18, 18 + 242)
@ -299,6 +274,8 @@ static MACHINE_CONFIG_START( ggconnie, ggconnie_state )
MCFG_HUC6270_ADD( "huc6270_1", sgx_huc6270_1_config )
MCFG_HUC6202_ADD( "huc6202", sgx_huc6202_config )
MCFG_MSM6242_ADD("rtc", ggconnie_rtc_intf)
MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker")
MCFG_SOUND_ADD("c6280", C6280, PCE_MAIN_CLOCK/6)
MCFG_SOUND_CONFIG(c6280_config)