From f0f5b81528236e3bf2d815e20bbb36a1728b0bba Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Thu, 6 Sep 2018 18:22:37 +0200 Subject: [PATCH] spoker.cpp: fixed 3super8 palette related crash, removed MCFG macros (nw) --- src/mame/drivers/spoker.cpp | 85 ++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 43 deletions(-) diff --git a/src/mame/drivers/spoker.cpp b/src/mame/drivers/spoker.cpp index e784936ab1c..0d27f125e2d 100644 --- a/src/mame/drivers/spoker.cpp +++ b/src/mame/drivers/spoker.cpp @@ -63,6 +63,11 @@ public: DECLARE_CUSTOM_INPUT_MEMBER(hopper_r); +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + private: required_device m_maincpu; required_device m_gfxdecode; @@ -99,10 +104,6 @@ private: DECLARE_WRITE8_MEMBER(magic_w); DECLARE_READ8_MEMBER(magic_r); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - TILE_GET_INFO_MEMBER(get_bg_tile_info); TILE_GET_INFO_MEMBER(get_fg_tile_info); @@ -282,15 +283,15 @@ void spoker_state::spoker_portmap(address_map &map) map(0x0000, 0x003f).ram(); // Z180 internal regs map(0x2000, 0x23ff).ram().w(m_palette, FUNC(palette_device::write8)).share("palette"); map(0x2400, 0x27ff).ram().w(m_palette, FUNC(palette_device::write8_ext)).share("palette_ext"); - map(0x3000, 0x33ff).ram().w(FUNC(spoker_state::bg_tile_w)).share("bg_tile_ram"); - map(0x5000, 0x5fff).ram().w(FUNC(spoker_state::fg_tile_w)).share("fg_tile_ram"); + map(0x3000, 0x33ff).ram().w(FUNC(spoker_state::bg_tile_w)).share(m_bg_tile_ram); + map(0x5000, 0x5fff).ram().w(FUNC(spoker_state::fg_tile_w)).share(m_fg_tile_ram); map(0x6480, 0x6483).rw("ppi8255_0", FUNC(i8255_device::read), FUNC(i8255_device::write)); /* NMI and coins (w), service (r), coins (r) */ map(0x6490, 0x6493).rw("ppi8255_1", FUNC(i8255_device::read), FUNC(i8255_device::write)); /* buttons 1 (r), video and leds (w), leds (w) */ map(0x64a0, 0x64a0).portr("BUTTONS2"); map(0x64b0, 0x64b1).w("ymsnd", FUNC(ym2413_device::write)); map(0x64c0, 0x64c0).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); map(0x64d0, 0x64d1).rw(FUNC(spoker_state::magic_r), FUNC(spoker_state::magic_w)); // DSW1-5 - map(0x7000, 0x7fff).ram().w(FUNC(spoker_state::fg_color_w)).share("fg_color_ram"); + map(0x7000, 0x7fff).ram().w(FUNC(spoker_state::fg_color_w)).share(m_fg_color_ram); } void spoker_state::_3super8_portmap(address_map &map) @@ -298,14 +299,14 @@ void spoker_state::_3super8_portmap(address_map &map) // AM_RANGE(0x1000, 0x1fff) AM_WRITENOP map(0x2000, 0x27ff).ram().w(m_palette, FUNC(palette_device::write8)).share("palette"); map(0x2800, 0x2fff).ram().w(m_palette, FUNC(palette_device::write8_ext)).share("palette_ext"); - map(0x3000, 0x33ff).ram().w(FUNC(spoker_state::bg_tile_w)).share("bg_tile_ram"); + map(0x3000, 0x33ff).ram().w(FUNC(spoker_state::bg_tile_w)).share(m_bg_tile_ram); map(0x4000, 0x4000).portr("DSW1"); map(0x4001, 0x4001).portr("DSW2"); map(0x4002, 0x4002).portr("DSW3"); map(0x4003, 0x4003).portr("DSW4"); map(0x4004, 0x4004).portr("DSW5"); // AM_RANGE(0x4000, 0x40ff) AM_WRITENOP - map(0x5000, 0x5fff).ram().w(FUNC(spoker_state::fg_tile_w)).share("fg_tile_ram"); + map(0x5000, 0x5fff).ram().w(FUNC(spoker_state::fg_tile_w)).share(m_fg_tile_ram); // The following one (0x6480) should be output. At beginning of code, there is a PPI initialization // setting O-I-I for ports ABC. Except these routines are just a leftover from the original game, @@ -318,7 +319,7 @@ void spoker_state::_3super8_portmap(address_map &map) map(0x64b0, 0x64b0).w(FUNC(spoker_state::leds_w)); map(0x64c0, 0x64c0).nopr(); //irq ack? map(0x64f0, 0x64f0).w(FUNC(spoker_state::nmi_and_coins_w)); - map(0x7000, 0x7fff).ram().w(FUNC(spoker_state::fg_color_w)).share("fg_color_ram"); + map(0x7000, 0x7fff).ram().w(FUNC(spoker_state::fg_color_w)).share(m_fg_color_ram); } @@ -607,13 +608,13 @@ void spoker_state::machine_reset() Machine Drivers ***************************************************************************/ -MACHINE_CONFIG_START(spoker_state::spoker) - +void spoker_state::spoker(machine_config &config) +{ /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", Z180, XTAL(12'000'000) / 2) /* HD64180RP8, 8 MHz? */ - MCFG_DEVICE_PROGRAM_MAP(spoker_map) - MCFG_DEVICE_IO_MAP(spoker_portmap) - MCFG_DEVICE_VBLANK_INT_DRIVER("screen", spoker_state, nmi_line_assert) + Z180(config, m_maincpu, XTAL(12'000'000) / 2); /* HD64180RP8, 8 MHz? */ + m_maincpu->set_addrmap(AS_PROGRAM, &spoker_state::spoker_map); + m_maincpu->set_addrmap(AS_IO, &spoker_state::spoker_portmap); + m_maincpu->set_vblank_int("screen", FUNC(spoker_state::nmi_line_assert)); NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); @@ -628,45 +629,43 @@ MACHINE_CONFIG_START(spoker_state::spoker) ppi1.out_pc_callback().set(FUNC(spoker_state::leds_w)); /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(512, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-16-1) - MCFG_SCREEN_UPDATE_DRIVER(spoker_state, screen_update) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_refresh_hz(60); + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0)); + m_screen->set_size(512, 256); + m_screen->set_visarea(0, 512-1, 0, 256-16-1); + m_screen->set_screen_update(FUNC(spoker_state::screen_update)); + m_screen->set_palette(m_palette); - MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_spoker) - MCFG_PALETTE_ADD("palette", 0x400) - MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) + GFXDECODE(config, m_gfxdecode, m_palette, gfx_spoker); + PALETTE(config, m_palette, 0x400).set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR); /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("ymsnd", YM2413, XTAL(3'579'545)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.4) + YM2413(config, "ymsnd", XTAL(3'579'545)).add_route(ALL_OUTPUTS, "mono", 1.4); - MCFG_DEVICE_ADD("oki", OKIM6295, XTAL(12'000'000) / 12, okim6295_device::PIN7_HIGH) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) -MACHINE_CONFIG_END + OKIM6295(config, "oki", XTAL(12'000'000) / 12, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 1.0); +} -MACHINE_CONFIG_START(spoker_state::_3super8) +void spoker_state::_3super8(machine_config &config) +{ spoker(config); - MCFG_DEVICE_REPLACE("maincpu", Z80, XTAL(24'000'000) / 4) /* z840006, 24/4 MHz? */ - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_PROGRAM_MAP(spoker_map) - MCFG_DEVICE_IO_MAP(_3super8_portmap) - MCFG_DEVICE_VBLANK_INT_DRIVER("screen", spoker_state, nmi_line_assert) - MCFG_DEVICE_PERIODIC_INT_DRIVER(spoker_state, irq0_line_hold, 120) // this signal comes from the PIC + Z80(config.replace(), m_maincpu, XTAL(24'000'000) / 4); /* z840006, 24/4 MHz? */ + m_maincpu->set_addrmap(AS_PROGRAM, &spoker_state::spoker_map); + m_maincpu->set_addrmap(AS_IO, &spoker_state::_3super8_portmap); + m_maincpu->set_vblank_int("screen", FUNC(spoker_state::nmi_line_assert)); + m_maincpu->set_periodic_int(FUNC(spoker_state::irq0_line_hold), attotime::from_hz(120)); // this signal comes from the PIC - MCFG_DEVICE_REMOVE("ppi8255_0") - MCFG_DEVICE_REMOVE("ppi8255_1") + config.device_remove("ppi8255_0"); + config.device_remove("ppi8255_1"); - MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_3super8) + m_gfxdecode->set_info(gfx_3super8); + m_palette->set_entries(0x800); - MCFG_DEVICE_REMOVE("ymsnd") -MACHINE_CONFIG_END + config.device_remove("ymsnd"); +} /***************************************************************************