From 9c880d0ed969afcb1531ac8f622f5d4bf087950e Mon Sep 17 00:00:00 2001 From: Osso13 Date: Mon, 19 Jan 2015 18:46:05 +0100 Subject: [PATCH] bogeyman.c: added missing save state, fixing noted save state regression. Also removed unneeded prefixes. (nw) --- src/mame/drivers/bogeyman.c | 31 ++++++++++++----------- src/mame/includes/bogeyman.h | 48 ++++++++++++++++++++++-------------- src/mame/video/bogeyman.c | 18 ++++++-------- 3 files changed, 54 insertions(+), 43 deletions(-) diff --git a/src/mame/drivers/bogeyman.c b/src/mame/drivers/bogeyman.c index 7cabb0a7918..000e719ca39 100644 --- a/src/mame/drivers/bogeyman.c +++ b/src/mame/drivers/bogeyman.c @@ -13,7 +13,6 @@ #include "emu.h" #include "cpu/m6502/m6502.h" -#include "sound/ay8910.h" #include "includes/bogeyman.h" @@ -21,23 +20,23 @@ // Sound section is copied from Mysterious Stones driver by Nicola, Mike, Brad -WRITE8_MEMBER(bogeyman_state::bogeyman_8910_latch_w) +WRITE8_MEMBER(bogeyman_state::ay8910_latch_w) { m_psg_latch = data; } -WRITE8_MEMBER(bogeyman_state::bogeyman_8910_control_w) +WRITE8_MEMBER(bogeyman_state::ay8910_control_w) { // bit 0 is flipscreen flip_screen_set(data & 0x01); // bit 5 goes to 8910 #0 BDIR pin if ((m_last_write & 0x20) == 0x20 && (data & 0x20) == 0x00) - machine().device("ay1")->data_address_w(space, m_last_write >> 4, m_psg_latch); + m_ay1->data_address_w(space, m_last_write >> 4, m_psg_latch); // bit 7 goes to 8910 #1 BDIR pin if ((m_last_write & 0x80) == 0x80 && (data & 0x80) == 0x00) - machine().device("ay2")->data_address_w(space, m_last_write >> 6, m_psg_latch); + m_ay2->data_address_w(space, m_last_write >> 6, m_psg_latch); m_last_write = data; } @@ -46,14 +45,14 @@ WRITE8_MEMBER(bogeyman_state::bogeyman_8910_control_w) static ADDRESS_MAP_START( bogeyman_map, AS_PROGRAM, 8, bogeyman_state ) AM_RANGE(0x0000, 0x17ff) AM_RAM - AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(bogeyman_videoram2_w) AM_SHARE("videoram2") - AM_RANGE(0x1c00, 0x1fff) AM_RAM_WRITE(bogeyman_colorram2_w) AM_SHARE("colorram2") - AM_RANGE(0x2000, 0x20ff) AM_RAM_WRITE(bogeyman_videoram_w) AM_SHARE("videoram") - AM_RANGE(0x2100, 0x21ff) AM_RAM_WRITE(bogeyman_colorram_w) AM_SHARE("colorram") + AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(videoram2_w) AM_SHARE("videoram2") + AM_RANGE(0x1c00, 0x1fff) AM_RAM_WRITE(colorram2_w) AM_SHARE("colorram2") + AM_RANGE(0x2000, 0x20ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram") + AM_RANGE(0x2100, 0x21ff) AM_RAM_WRITE(colorram_w) AM_SHARE("colorram") AM_RANGE(0x2800, 0x2bff) AM_RAM AM_SHARE("spriteram") - AM_RANGE(0x3000, 0x300f) AM_RAM_WRITE(bogeyman_paletteram_w) AM_SHARE("palette") - AM_RANGE(0x3800, 0x3800) AM_READ_PORT("P1") AM_WRITE(bogeyman_8910_control_w) - AM_RANGE(0x3801, 0x3801) AM_READ_PORT("P2") AM_WRITE(bogeyman_8910_latch_w) + AM_RANGE(0x3000, 0x300f) AM_RAM_WRITE(paletteram_w) AM_SHARE("palette") + AM_RANGE(0x3800, 0x3800) AM_READ_PORT("P1") AM_WRITE(ay8910_control_w) + AM_RANGE(0x3801, 0x3801) AM_READ_PORT("P2") AM_WRITE(ay8910_latch_w) AM_RANGE(0x3802, 0x3802) AM_READ_PORT("DSW1") AM_RANGE(0x3803, 0x3803) AM_READ_PORT("DSW2") AM_WRITENOP // ??? sound AM_RANGE(0x4000, 0xffff) AM_ROM @@ -205,15 +204,17 @@ void bogeyman_state::machine_start() { save_item(NAME(m_psg_latch)); save_item(NAME(m_last_write)); + save_item(NAME(m_colbank)); } void bogeyman_state::machine_reset() { m_psg_latch = 0; m_last_write = 0; + m_colbank = 0; } -WRITE8_MEMBER(bogeyman_state::bogeyman_colbank_w) +WRITE8_MEMBER(bogeyman_state::colbank_w) { if((data & 1) != (m_colbank & 1)) { @@ -237,7 +238,7 @@ static MACHINE_CONFIG_START( bogeyman, bogeyman_state ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) MCFG_SCREEN_SIZE(32*8, 32*8) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1) - MCFG_SCREEN_UPDATE_DRIVER(bogeyman_state, screen_update_bogeyman) + MCFG_SCREEN_UPDATE_DRIVER(bogeyman_state, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", bogeyman) @@ -249,7 +250,7 @@ static MACHINE_CONFIG_START( bogeyman, bogeyman_state ) MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("ay1", AY8910, 1500000) /* Verified */ - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(bogeyman_state, bogeyman_colbank_w)) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(bogeyman_state, colbank_w)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) MCFG_SOUND_ADD("ay2", AY8910, 1500000) /* Verified */ diff --git a/src/mame/includes/bogeyman.h b/src/mame/includes/bogeyman.h index 1f2f6b2f497..46e65975120 100644 --- a/src/mame/includes/bogeyman.h +++ b/src/mame/includes/bogeyman.h @@ -4,20 +4,31 @@ *************************************************************************/ +#include "sound/ay8910.h" + class bogeyman_state : public driver_device { public: bogeyman_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_ay1(*this, "ay1"), + m_ay2(*this, "ay2"), m_videoram(*this, "videoram"), m_videoram2(*this, "videoram2"), m_colorram(*this, "colorram"), m_colorram2(*this, "colorram2"), - m_spriteram(*this, "spriteram"), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } - + m_spriteram(*this, "spriteram") { } + + /* devices */ + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + required_device m_ay1; + required_device m_ay2; + /* memory pointers */ required_shared_ptr m_videoram; required_shared_ptr m_videoram2; @@ -34,23 +45,24 @@ public: int m_psg_latch; int m_last_write; int m_colbank; - DECLARE_WRITE8_MEMBER(bogeyman_8910_latch_w); - DECLARE_WRITE8_MEMBER(bogeyman_8910_control_w); - DECLARE_WRITE8_MEMBER(bogeyman_videoram_w); - DECLARE_WRITE8_MEMBER(bogeyman_colorram_w); - DECLARE_WRITE8_MEMBER(bogeyman_videoram2_w); - DECLARE_WRITE8_MEMBER(bogeyman_colorram2_w); - DECLARE_WRITE8_MEMBER(bogeyman_paletteram_w); - DECLARE_WRITE8_MEMBER(bogeyman_colbank_w); + + DECLARE_WRITE8_MEMBER(ay8910_latch_w); + DECLARE_WRITE8_MEMBER(ay8910_control_w); + DECLARE_WRITE8_MEMBER(videoram_w); + DECLARE_WRITE8_MEMBER(colorram_w); + DECLARE_WRITE8_MEMBER(videoram2_w); + DECLARE_WRITE8_MEMBER(colorram2_w); + DECLARE_WRITE8_MEMBER(paletteram_w); + DECLARE_WRITE8_MEMBER(colbank_w); + TILE_GET_INFO_MEMBER(get_bg_tile_info); TILE_GET_INFO_MEMBER(get_fg_tile_info); + virtual void machine_start(); virtual void machine_reset(); virtual void video_start(); + DECLARE_PALETTE_INIT(bogeyman); - UINT32 screen_update_bogeyman(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); }; diff --git a/src/mame/video/bogeyman.c b/src/mame/video/bogeyman.c index ea605ebb2c9..c2ef0d14024 100644 --- a/src/mame/video/bogeyman.c +++ b/src/mame/video/bogeyman.c @@ -36,31 +36,31 @@ PALETTE_INIT_MEMBER(bogeyman_state, bogeyman) } } -WRITE8_MEMBER(bogeyman_state::bogeyman_videoram_w) +WRITE8_MEMBER(bogeyman_state::videoram_w) { m_videoram[offset] = data; m_bg_tilemap->mark_tile_dirty(offset); } -WRITE8_MEMBER(bogeyman_state::bogeyman_colorram_w) +WRITE8_MEMBER(bogeyman_state::colorram_w) { m_colorram[offset] = data; m_bg_tilemap->mark_tile_dirty(offset); } -WRITE8_MEMBER(bogeyman_state::bogeyman_videoram2_w) +WRITE8_MEMBER(bogeyman_state::videoram2_w) { m_videoram2[offset] = data; m_fg_tilemap->mark_tile_dirty(offset); } -WRITE8_MEMBER(bogeyman_state::bogeyman_colorram2_w) +WRITE8_MEMBER(bogeyman_state::colorram2_w) { m_colorram2[offset] = data; m_fg_tilemap->mark_tile_dirty(offset); } -WRITE8_MEMBER(bogeyman_state::bogeyman_paletteram_w) +WRITE8_MEMBER(bogeyman_state::paletteram_w) { /* RGB output is inverted */ m_palette->write(space, offset, UINT8(~data)); @@ -94,11 +94,9 @@ void bogeyman_state::video_start() m_fg_tilemap->set_transparent_pen(0); } -void bogeyman_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) +void bogeyman_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int offs; - - for (offs = 0; offs < m_spriteram.bytes(); offs += 4) + for (int offs = 0; offs < m_spriteram.bytes(); offs += 4) { int attr = m_spriteram[offs]; @@ -139,7 +137,7 @@ void bogeyman_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre } } -UINT32 bogeyman_state::screen_update_bogeyman(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +UINT32 bogeyman_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); draw_sprites(bitmap, cliprect);