From abb48bb5e428102d2983d1da0ad6f6262e2ed566 Mon Sep 17 00:00:00 2001 From: AJR Date: Tue, 6 Feb 2018 23:56:18 -0500 Subject: luckgrln.cpp: Use MSM6242 device (nw) --- src/mame/drivers/luckgrln.cpp | 46 ++++++++++++------------------------------- 1 file changed, 13 insertions(+), 33 deletions(-) diff --git a/src/mame/drivers/luckgrln.cpp b/src/mame/drivers/luckgrln.cpp index 3a3d5ef7df4..e9bd391277a 100644 --- a/src/mame/drivers/luckgrln.cpp +++ b/src/mame/drivers/luckgrln.cpp @@ -81,6 +81,7 @@ #include "emu.h" #include "cpu/z180/z180.h" +#include "machine/msm6242.h" #include "video/mc6845.h" #include "screen.h" #include "speaker.h" @@ -147,7 +148,6 @@ public: DECLARE_WRITE8_MEMBER(palette_offset_low_w); DECLARE_WRITE8_MEMBER(palette_offset_high_w); DECLARE_WRITE8_MEMBER(palette_w); - DECLARE_READ8_MEMBER(rtc_r); DECLARE_WRITE8_MEMBER(lamps_a_w); DECLARE_WRITE8_MEMBER(lamps_b_w); DECLARE_WRITE8_MEMBER(counters_w); @@ -483,33 +483,6 @@ WRITE8_MEMBER(luckgrln_state::palette_w) } -// Oki M62X428 is a 4-bit RTC, doesn't seem to be millennium bug proof ... -READ8_MEMBER(luckgrln_state::rtc_r) -{ - system_time systime; - machine().base_datetime(systime); - - switch(offset) - { - case 0x00: return (systime.local_time.second % 10); - case 0x01: return (systime.local_time.second / 10); - case 0x02: return (systime.local_time.minute % 10); - case 0x03: return (systime.local_time.minute / 10); - case 0x04: return (systime.local_time.hour % 10); - case 0x05: return (systime.local_time.hour / 10); - case 0x06: return (systime.local_time.mday % 10); - case 0x07: return (systime.local_time.mday / 10); - case 0x08: return ((systime.local_time.month+1) % 10); - case 0x09: return ((systime.local_time.month+1) / 10); - case 0x0a: return (systime.local_time.year%10); - case 0x0b: return ((systime.local_time.year%100)/10); - - case 0x0d: return 0xff; // bit 1: reset switch for the RTC? - } - - return 0; -} - /* Analizing the lamps, the game should has a 12-buttons control layout */ WRITE8_MEMBER(luckgrln_state::lamps_a_w) { @@ -575,13 +548,11 @@ WRITE8_MEMBER(luckgrln_state::counters_w) /* are some of these reads / writes mirrored? there seem to be far too many */ -static ADDRESS_MAP_START( portmap, AS_IO, 8, luckgrln_state ) +static ADDRESS_MAP_START( common_portmap, AS_IO, 8, luckgrln_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x0000, 0x003f) AM_RAM // Z180 internal regs AM_RANGE(0x0060, 0x0060) AM_WRITE(output_w) - AM_RANGE(0x0090, 0x009f) AM_READ(rtc_r) //AM_WRITENOP - AM_RANGE(0x00a0, 0x00a0) AM_WRITE(palette_offset_low_w) AM_RANGE(0x00a1, 0x00a1) AM_WRITE(palette_offset_high_w) AM_RANGE(0x00a2, 0x00a2) AM_WRITE(palette_w) @@ -629,6 +600,11 @@ static ADDRESS_MAP_START( portmap, AS_IO, 8, luckgrln_state ) ADDRESS_MAP_END +static ADDRESS_MAP_START( luckgrln_io, AS_IO, 8, luckgrln_state ) + AM_IMPORT_FROM( common_portmap ) + AM_RANGE(0x0090, 0x009f) AM_DEVREADWRITE("rtc", msm6242_device, read, write) +ADDRESS_MAP_END + /* reads a bit 1 status there after every round played */ READ8_MEMBER(luckgrln_state::test_r) { @@ -636,7 +612,7 @@ READ8_MEMBER(luckgrln_state::test_r) } static ADDRESS_MAP_START( _7smash_io, AS_IO, 8, luckgrln_state ) - AM_IMPORT_FROM( portmap ) + AM_IMPORT_FROM( common_portmap ) AM_RANGE(0x66, 0x66) AM_READ(test_r) ADDRESS_MAP_END @@ -991,13 +967,15 @@ INTERRUPT_GEN_MEMBER(luckgrln_state::luckgrln_irq) MACHINE_CONFIG_START(luckgrln_state::luckgrln) MCFG_CPU_ADD("maincpu", Z180,8000000) MCFG_CPU_PROGRAM_MAP(mainmap) - MCFG_CPU_IO_MAP(portmap) + MCFG_CPU_IO_MAP(luckgrln_io) MCFG_CPU_VBLANK_INT_DRIVER("screen", luckgrln_state, luckgrln_irq) MCFG_MC6845_ADD("crtc", H46505, "screen", 6000000/4) /* unknown clock, hand tuned to get ~60 fps */ MCFG_MC6845_SHOW_BORDER_AREA(false) MCFG_MC6845_CHAR_WIDTH(8) + MCFG_DEVICE_ADD("rtc", MSM6242, 0) + MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) @@ -1017,6 +995,8 @@ MACHINE_CONFIG_DERIVED(luckgrln_state::_7smash, luckgrln) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(_7smash_map) MCFG_CPU_IO_MAP(_7smash_io) + + MCFG_DEVICE_REMOVE("rtc") MACHINE_CONFIG_END DRIVER_INIT_MEMBER(luckgrln_state,luckgrln) -- cgit v1.2.3