From 1314d8f6a90a5ea60334f17f0723e35947dcfbf7 Mon Sep 17 00:00:00 2001 From: AJR Date: Mon, 24 Jul 2017 09:48:00 -0400 Subject: funystrp: Separate driver state class (nw) --- src/mame/drivers/splash.cpp | 65 +++++++++++++------------------ src/mame/includes/splash.h | 95 +++++++++++++++++++++++++-------------------- src/mame/video/splash.cpp | 4 +- 3 files changed, 82 insertions(+), 82 deletions(-) diff --git a/src/mame/drivers/splash.cpp b/src/mame/drivers/splash.cpp index 95771c7d311..6f8e92a3f5e 100644 --- a/src/mame/drivers/splash.cpp +++ b/src/mame/drivers/splash.cpp @@ -207,31 +207,31 @@ static ADDRESS_MAP_START( roldfrog_sound_io_map, AS_IO, 8, splash_state ) AM_RANGE(0x0, 0xff) AM_READ(roldfrog_unk_r) ADDRESS_MAP_END -READ16_MEMBER(splash_state::spr_read) +READ16_MEMBER(funystrp_state::spr_read) { return m_spriteram[offset]|0xff00; } -WRITE16_MEMBER(splash_state::spr_write) +WRITE16_MEMBER(funystrp_state::spr_write) { COMBINE_DATA(&m_spriteram[offset]); m_spriteram[offset]|=0xff00; /* 8 bit, expected 0xffnn when read as 16 bit */ } -WRITE16_MEMBER(splash_state::funystrp_sh_irqtrigger_w) +WRITE16_MEMBER(funystrp_state::sh_irqtrigger_w) { m_soundlatch->write(space, 0, data>>8); m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } -WRITE8_MEMBER(splash_state::funystrp_eeprom_w) +WRITE8_MEMBER(funystrp_state::eeprom_w) { m_eeprom->cs_write(BIT(data, 4)); m_eeprom->di_write(BIT(data, 6)); m_eeprom->clk_write(BIT(data, 5)); } -static ADDRESS_MAP_START( funystrp_map, AS_PROGRAM, 16, splash_state ) +static ADDRESS_MAP_START( funystrp_map, AS_PROGRAM, 16, funystrp_state ) AM_RANGE(0x000000, 0x07ffff) AM_ROM /* ROM */ AM_RANGE(0x100000, 0x1fffff) AM_RAM /* protection? RAM */ AM_RANGE(0x800000, 0x83ffff) AM_RAM AM_SHARE("pixelram") /* Pixel Layer */ @@ -240,8 +240,8 @@ static ADDRESS_MAP_START( funystrp_map, AS_PROGRAM, 16, splash_state ) AM_RANGE(0x840004, 0x840005) AM_READ_PORT("P1") AM_RANGE(0x840006, 0x840007) AM_READ_PORT("P2") AM_RANGE(0x840008, 0x840009) AM_READ_PORT("SYSTEM") - AM_RANGE(0x84000a, 0x84000b) AM_WRITE8(funystrp_eeprom_w, 0xff00) AM_READNOP - AM_RANGE(0x84000e, 0x84000f) AM_WRITE(funystrp_sh_irqtrigger_w) /* Sound command */ + AM_RANGE(0x84000a, 0x84000b) AM_WRITE8(eeprom_w, 0xff00) AM_READNOP + AM_RANGE(0x84000e, 0x84000f) AM_WRITE(sh_irqtrigger_w) /* Sound command */ AM_RANGE(0x880000, 0x8817ff) AM_RAM_WRITE(vram_w) AM_SHARE("videoram") /* Video RAM */ AM_RANGE(0x881800, 0x881803) AM_RAM AM_SHARE("vregs") /* Scroll registers */ AM_RANGE(0x881804, 0x881fff) AM_RAM @@ -256,36 +256,36 @@ static ADDRESS_MAP_START( funystrp_sound_map, AS_PROGRAM, 8, splash_state ) AM_RANGE(0x8000, 0xffff) AM_ROM AM_ROMBANK("sound_bank") ADDRESS_MAP_END -READ8_MEMBER(splash_state::int_source_r) +READ8_MEMBER(funystrp_state::int_source_r) { return ~m_msm_source; } -WRITE8_MEMBER(splash_state::msm1_data_w) +WRITE8_MEMBER(funystrp_state::msm1_data_w) { m_msm_data1=data; m_msm_source&=~1; m_msm_toggle1=0; } -WRITE8_MEMBER(splash_state::msm1_interrupt_w) +WRITE8_MEMBER(funystrp_state::msm1_interrupt_w) { m_snd_interrupt_enable1=~data; } -WRITE8_MEMBER(splash_state::msm2_interrupt_w) +WRITE8_MEMBER(funystrp_state::msm2_interrupt_w) { m_snd_interrupt_enable2=~data; } -WRITE8_MEMBER(splash_state::msm2_data_w) +WRITE8_MEMBER(funystrp_state::msm2_data_w) { m_msm_data2=data; m_msm_source&=~2; m_msm_toggle2=0; } -static ADDRESS_MAP_START( funystrp_sound_io_map, AS_IO, 8, splash_state ) +static ADDRESS_MAP_START( funystrp_sound_io_map, AS_IO, 8, funystrp_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x00) AM_WRITE(msm1_data_w) AM_RANGE(0x01, 0x01) AM_WRITE(msm2_data_w) @@ -296,12 +296,6 @@ static ADDRESS_MAP_START( funystrp_sound_io_map, AS_IO, 8, splash_state ) AM_RANGE(0x07, 0x07) AM_WRITE(msm2_interrupt_w) ADDRESS_MAP_END -MACHINE_RESET_MEMBER(splash_state,funystrp) -{ - m_adpcm_data = 0; - m_ret = 0x100; -} - static INPUT_PORTS_START( splash ) PORT_START("DSW1") @@ -592,7 +586,7 @@ static MACHINE_CONFIG_START( roldfrog ) MCFG_SOUND_ROUTE(3, "mono", 1.0) MACHINE_CONFIG_END -WRITE_LINE_MEMBER(splash_state::adpcm_int1) +WRITE_LINE_MEMBER(funystrp_state::adpcm_int1) { if (m_snd_interrupt_enable1 || m_msm_toggle1 == 1) { @@ -607,7 +601,7 @@ WRITE_LINE_MEMBER(splash_state::adpcm_int1) } } -WRITE_LINE_MEMBER(splash_state::adpcm_int2) +WRITE_LINE_MEMBER(funystrp_state::adpcm_int2) { if (m_snd_interrupt_enable2 || m_msm_toggle2 == 1) { @@ -623,7 +617,7 @@ WRITE_LINE_MEMBER(splash_state::adpcm_int2) } -MACHINE_START_MEMBER(splash_state, funystrp) +void funystrp_state::machine_start() { save_item(NAME(m_funystrp_val)); save_item(NAME(m_funystrp_ff3cc7_val)); @@ -642,7 +636,7 @@ static MACHINE_CONFIG_START( funystrp ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, XTAL_24MHz/2) /* 12 MHz (24/2) */ MCFG_CPU_PROGRAM_MAP(funystrp_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", splash_state, irq6_line_hold) + MCFG_CPU_VBLANK_INT_DRIVER("screen", funystrp_state, irq6_line_hold) MCFG_CPU_ADD("audiocpu", Z80, XTAL_24MHz/4) /* 6MHz (24/4) */ MCFG_CPU_PROGRAM_MAP(funystrp_sound_map) @@ -656,28 +650,25 @@ static MACHINE_CONFIG_START( funystrp ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) MCFG_SCREEN_SIZE(64*8, 64*8) MCFG_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 2*8, 32*8-1) - MCFG_SCREEN_UPDATE_DRIVER(splash_state, screen_update_funystrp) + MCFG_SCREEN_UPDATE_DRIVER(funystrp_state, screen_update_funystrp) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", splash) MCFG_PALETTE_ADD("palette", 2048) MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) - MCFG_MACHINE_START_OVERRIDE(splash_state, funystrp ) - MCFG_MACHINE_RESET_OVERRIDE(splash_state, funystrp ) - /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_GENERIC_LATCH_8_ADD("soundlatch") MCFG_SOUND_ADD("msm1", MSM5205, XTAL_400kHz) - MCFG_MSM5205_VCLK_CB(WRITELINE(splash_state, adpcm_int1)) /* interrupt function */ + MCFG_MSM5205_VCLK_CB(WRITELINE(funystrp_state, adpcm_int1)) /* interrupt function */ MCFG_MSM5205_PRESCALER_SELECTOR(S48_4B) /* 1 / 48 */ /* Sample rate = 400kHz/64 */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) MCFG_SOUND_ADD("msm2", MSM5205, XTAL_400kHz) - MCFG_MSM5205_VCLK_CB(WRITELINE(splash_state, adpcm_int2)) /* interrupt function */ + MCFG_MSM5205_VCLK_CB(WRITELINE(funystrp_state, adpcm_int2)) /* interrupt function */ MCFG_MSM5205_PRESCALER_SELECTOR(S96_4B) /* 1 / 96 */ /* Sample rate = 400kHz/96 */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) MACHINE_CONFIG_END @@ -1095,7 +1086,7 @@ DRIVER_INIT_MEMBER(splash_state,rebus) -READ16_MEMBER(splash_state::funystrp_protection_r) +READ16_MEMBER(funystrp_state::protection_r) { int pc = space.device().safe_pc(); @@ -1376,7 +1367,7 @@ READ16_MEMBER(splash_state::funystrp_protection_r) return 0; } -WRITE16_MEMBER(splash_state::funystrp_protection_w) +WRITE16_MEMBER(funystrp_state::protection_w) { int ofst = (0x100000/2)+offset; @@ -1406,7 +1397,7 @@ WRITE16_MEMBER(splash_state::funystrp_protection_w) } } -DRIVER_INIT_MEMBER(splash_state,funystrp) +DRIVER_INIT_MEMBER(funystrp_state,funystrp) { m_bitmap_type = 0; m_sprite_attr2_shift = 0; @@ -1415,8 +1406,8 @@ DRIVER_INIT_MEMBER(splash_state,funystrp) membank("sound_bank")->configure_entries(0, 16, &ROM[0x00000], 0x8000); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x100000, 0x1fffff, write16_delegate(FUNC(splash_state::funystrp_protection_w), this)); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x100000, 0x1fffff, read16_delegate(FUNC(splash_state::funystrp_protection_r),this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x100000, 0x1fffff, write16_delegate(FUNC(funystrp_state::protection_w), this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x100000, 0x1fffff, read16_delegate(FUNC(funystrp_state::protection_r),this)); } GAME( 1992, splash, 0, splash, splash, splash_state, splash, ROT0, "Gaelco / OMK Software", "Splash! (Ver. 1.2 World)", MACHINE_SUPPORTS_SAVE ) @@ -1426,6 +1417,6 @@ GAME( 1992, paintlad, splash, splash, splash, splash_state, splash, ROT0 GAME( 1993, roldfrog, 0, roldfrog, splash, splash_state, roldfrog, ROT0, "Microhard", "The Return of Lady Frog (set 1)", MACHINE_SUPPORTS_SAVE ) GAME( 1993, roldfroga,roldfrog, roldfrog, splash, splash_state, roldfrog, ROT0, "Microhard", "The Return of Lady Frog (set 2)", MACHINE_SUPPORTS_SAVE ) GAME( 1995, rebus, 0, roldfrog, splash, splash_state, rebus, ROT0, "Microhard", "Rebus", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 199?, funystrp, 0, funystrp, funystrp, splash_state, funystrp, ROT0, "Microhard / MagicGames", "Funny Strip", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_SUPPORTS_SAVE ) -GAME( 199?, puckpepl, funystrp, funystrp, funystrp, splash_state, funystrp, ROT0, "Microhard", "Puck People", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_SUPPORTS_SAVE ) -GAME( 199?, ringball, funystrp, funystrp, funystrp, splash_state, funystrp, ROT0, "Microhard", "Ring & Ball (unknown title)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_SUPPORTS_SAVE ) // Wouldn't surprise me if in-game is actually called King & Bell ... +GAME( 199?, funystrp, 0, funystrp, funystrp, funystrp_state, funystrp, ROT0, "Microhard / MagicGames", "Funny Strip", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_SUPPORTS_SAVE ) +GAME( 199?, puckpepl, funystrp, funystrp, funystrp, funystrp_state, funystrp, ROT0, "Microhard", "Puck People", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_SUPPORTS_SAVE ) +GAME( 199?, ringball, funystrp, funystrp, funystrp, funystrp_state, funystrp, ROT0, "Microhard", "Ring & Ball (unknown title)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_SUPPORTS_SAVE ) // Wouldn't surprise me if in-game is actually called King & Bell ... diff --git a/src/mame/includes/splash.h b/src/mame/includes/splash.h index f4e6109f44c..da40cfae925 100644 --- a/src/mame/includes/splash.h +++ b/src/mame/includes/splash.h @@ -13,33 +13,23 @@ public: m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_msm(*this, "msm"), - m_msm1(*this, "msm1"), - m_msm2(*this, "msm2"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_soundlatch(*this, "soundlatch"), - m_eeprom(*this, "eeprom"), m_pixelram(*this, "pixelram"), m_videoram(*this, "videoram"), m_vregs(*this, "vregs"), m_spriteram(*this, "spriteram"), m_protdata(*this, "protdata"), - m_bitmap_mode(*this, "bitmap_mode"), - - m_funystrp_val(0), - m_funystrp_ff3cc7_val(0), - m_funystrp_ff3cc8_val(0) + m_bitmap_mode(*this, "bitmap_mode") { } required_device m_maincpu; required_device m_audiocpu; optional_device m_msm; - optional_device m_msm1; - optional_device m_msm2; required_device m_gfxdecode; required_device m_palette; required_device m_soundlatch; - optional_device m_eeprom; required_shared_ptr m_pixelram; required_shared_ptr m_videoram; @@ -62,18 +52,6 @@ public: int m_vblank_irq; int m_sound_irq; - // funystrp specific - uint8_t m_funystrp_val; - uint8_t m_funystrp_ff3cc7_val; - uint8_t m_funystrp_ff3cc8_val; - int m_msm_data1; - int m_msm_data2; - int m_msm_toggle1; - int m_msm_toggle2; - int m_msm_source; - int m_snd_interrupt_enable1; - int m_snd_interrupt_enable2; - // common DECLARE_WRITE16_MEMBER(vram_w); DECLARE_WRITE16_MEMBER(coin_w); @@ -90,21 +68,6 @@ public: DECLARE_READ8_MEMBER(roldfrog_unk_r); DECLARE_WRITE_LINE_MEMBER(ym_irq); - // funystrp specific - DECLARE_READ16_MEMBER(spr_read); - DECLARE_WRITE16_MEMBER(spr_write); - DECLARE_READ8_MEMBER(int_source_r); - DECLARE_WRITE8_MEMBER(msm1_data_w); - DECLARE_WRITE8_MEMBER(msm1_interrupt_w); - DECLARE_WRITE8_MEMBER(msm2_interrupt_w); - DECLARE_WRITE8_MEMBER(msm2_data_w); - DECLARE_WRITE_LINE_MEMBER(adpcm_int1); - DECLARE_WRITE_LINE_MEMBER(adpcm_int2); - DECLARE_WRITE16_MEMBER(funystrp_protection_w); - DECLARE_READ16_MEMBER(funystrp_protection_r); - DECLARE_WRITE16_MEMBER(funystrp_sh_irqtrigger_w); - DECLARE_WRITE8_MEMBER(funystrp_eeprom_w); - //roldfrog and funystrp specific DECLARE_WRITE8_MEMBER(sound_bank_w); @@ -112,23 +75,69 @@ public: DECLARE_DRIVER_INIT(roldfrog); DECLARE_DRIVER_INIT(splash); DECLARE_DRIVER_INIT(rebus); - DECLARE_DRIVER_INIT(funystrp); virtual void video_start() override; DECLARE_MACHINE_START(splash); DECLARE_MACHINE_START(roldfrog); - DECLARE_MACHINE_START(funystrp); DECLARE_MACHINE_RESET(splash); - DECLARE_MACHINE_RESET(funystrp); TILE_GET_INFO_MEMBER(get_tile_info_tilemap0); TILE_GET_INFO_MEMBER(get_tile_info_tilemap1); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_funystrp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); - void funystrp_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); INTERRUPT_GEN_MEMBER(roldfrog_interrupt); void roldfrog_update_irq( ); }; + +class funystrp_state : public splash_state +{ +public: + funystrp_state(const machine_config &mconfig, device_type type, const char *tag) + : splash_state(mconfig, type, tag), + m_msm1(*this, "msm1"), + m_msm2(*this, "msm2"), + m_eeprom(*this, "eeprom"), + m_funystrp_val(0), + m_funystrp_ff3cc7_val(0), + m_funystrp_ff3cc8_val(0) + { } + + DECLARE_READ16_MEMBER(spr_read); + DECLARE_WRITE16_MEMBER(spr_write); + DECLARE_READ8_MEMBER(int_source_r); + DECLARE_WRITE8_MEMBER(msm1_data_w); + DECLARE_WRITE8_MEMBER(msm1_interrupt_w); + DECLARE_WRITE8_MEMBER(msm2_interrupt_w); + DECLARE_WRITE8_MEMBER(msm2_data_w); + DECLARE_WRITE_LINE_MEMBER(adpcm_int1); + DECLARE_WRITE_LINE_MEMBER(adpcm_int2); + DECLARE_WRITE16_MEMBER(protection_w); + DECLARE_READ16_MEMBER(protection_r); + DECLARE_WRITE16_MEMBER(sh_irqtrigger_w); + DECLARE_WRITE8_MEMBER(eeprom_w); + + DECLARE_DRIVER_INIT(funystrp); + + uint32_t screen_update_funystrp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void funystrp_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + +private: + virtual void machine_start() override; + + required_device m_msm1; + required_device m_msm2; + required_device m_eeprom; + + uint8_t m_funystrp_val; + uint8_t m_funystrp_ff3cc7_val; + uint8_t m_funystrp_ff3cc8_val; + int m_msm_data1; + int m_msm_data2; + int m_msm_toggle1; + int m_msm_toggle2; + int m_msm_source; + int m_snd_interrupt_enable1; + int m_snd_interrupt_enable2; +}; diff --git a/src/mame/video/splash.cpp b/src/mame/video/splash.cpp index d3cf0b35ef4..0ccceadb7b1 100644 --- a/src/mame/video/splash.cpp +++ b/src/mame/video/splash.cpp @@ -223,7 +223,7 @@ void splash_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) } } -void splash_state::funystrp_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) +void funystrp_state::funystrp_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) { int i; gfx_element *gfx = m_gfxdecode->gfx(1); @@ -263,7 +263,7 @@ uint32_t splash_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap return 0; } -uint32_t splash_state::screen_update_funystrp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t funystrp_state::screen_update_funystrp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { /* set scroll registers */ m_bg_tilemap[0]->set_scrolly(0, m_vregs[0]); -- cgit v1.2.3